0
我会下载与DownloadManager在一个特定的目录中的文件。在我的应用程序开始时,我创建了(如果不存在)的文件夹:无法给一个DownloadManager的路径
if (storageState.equals(Environment.MEDIA_MOUNTED)) {
externalStorageWriteable = true;
directory_path = Environment.getExternalStorageDirectory()
+ "/" + context.getResources().getString(R.string.app_name);
directory = new File(directory_path);
if (!directory.exists()) {
directory.mkdirs();
}
}
,如果我有一个文件管理器检查,文件夹,它可以在/ SD卡/ FOLDERNAME,但如果我在logcat的目录路径可变印刷,我获得
/storage/emulated/0/folderName
我试图通过传递目标文件夹一样
Uri destination = Uri.fromFile(new File(directory_path));
request.setDestinationUri(destination);
//request is of type DownloadManager.Request
下载文件,但是当我检查其中file它的存储,我的文件夹是空的,下载的文件存储在侧/ sdcard /下载
有人能告诉我为什么以及如何解决这个问题?
它不工作过。 – giozh