Android:使用DownloadManager从互联网下载文件并将其保存到内部存储器
问题描述:
我正在使用DownloadManager
从网络下载文件到我的Android设备。我正在使用SD卡保存此文件:Android:使用DownloadManager从互联网下载文件并将其保存到内部存储器
DownloadManager.Request req = new DownloadManager.Request(Uri.parse("file path"));
req.setTitle("file title").setDescription("Downloading ....") // download the package at the /sdcard/download path.
.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "file name"+ "file extension");
我想把它保存到内部存储。怎么做?
答
使用此路径.setDestinationInExternalPublicDir(Environment.getExternalStorageDirectory() +"/Android/data/xxx.xxx.xxx/files/")
谢谢,我会试试看。 – user1471575 2012-07-05 09:02:39
我得到了拒绝的权限!我需要什么类型的权限? – user1471575 2012-07-05 09:31:02
不工作:java.io.IOException:没有这样的文件或目录 – user1471575 2012-07-05 09:35:08