安卓:使用下载管理器从互联网上下载文件并保存到内部存储器 [英] Android: download file from internet using DownloadManager and save it to the internal memory

查看:384
本文介绍了安卓:使用下载管理器从互联网上下载文件并保存到内部存储器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的下载从Web文件到我的Andr​​oid设备下载管理器。我使用节省了SD卡这个文件:

I am downloading a file from the web to my Android device using DownloadManager. I am saving this file on the sdcard using:

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

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

I want to save it to the internal storage. How to do that?

推荐答案

使用此路径 .setDestinationInExternalPublicDir(Environment.getExternalStorageDirectory()
             +/ Android的/数据/ xxx.xxx.xxx /文件/)

这篇关于安卓:使用下载管理器从互联网上下载文件并保存到内部存储器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆