【发布时间】:2020-06-03 04:33:25
【问题描述】:
写入包 java.lang.IllegalStateException 异常:不是标准目录之一:/storage/emulated/0/Android/data.......
DownloadManager dm = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE);
Uri uri = Uri.parse(s);
DownloadManager.Request req = new DownloadManager.Request(uri);
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
String filename = VideoTitle;
filename += ".mp4";
req.setDestinationInExternalPublicDir(context.getResources().getString(R.string.video_dir_path), filename);
req.setDestinationInExternalFilesDir(context,dir_path,filename);
StyleableToast.makeText(context,context.getResources().getString(R.string.download_started), Toast.LENGTH_SHORT, R.style.mytoast).show();
Long ref = dm.enqueue(req);
如何解决这个错误??
【问题讨论】:
标签: download-manager