【问题标题】:Android: download file from internet using DownloadManager and save it to the internal memoryAndroid:使用 DownloadManager 从 Internet 下载文件并将其保存到内存中
【发布时间】:2012-07-05 15:39:18
【问题描述】:

我正在使用 DownloadManager 将文件从网络下载到我的 Android 设备。我将此文件保存在 sdcard 上,使用:

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");

我想将它保存到内部存储中。该怎么做?

【问题讨论】:

    标签: android memory storage internal download-manager


    【解决方案1】:

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

    【讨论】:

    • 我的权限被拒绝!我需要什么类型的权限?
    • 这是为了保存在外部存储中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-03
    • 1970-01-01
    • 2014-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多