2012-07-05 62 views
4

我正在使用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"); 

我想把它保存到内部存储。怎么做?

回答

1

使用此路径.setDestinationInExternalPublicDir(Environment.getExternalStorageDirectory() +"/Android/data/xxx.xxx.xxx/files/")

+0

谢谢,我会试试看。 – user1471575 2012-07-05 09:02:39

+1

我得到了拒绝的权限!我需要什么类型的权限? – user1471575 2012-07-05 09:31:02

+1

不工作:java.io.IOException:没有这样的文件或目录 – user1471575 2012-07-05 09:35:08

相关问题