Android的:在使用下载的数据保存到内部存储器 [英] Android: Save data to internal memory using Download

查看:304
本文介绍了Android的:在使用下载的数据保存到内部存储器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Android中的服务器使用下载管理器类下载文件。欲将此文件存储在该装置的内部存储器中。我试图用 .setDestinationInExternalPublicDir(Environment.getExternalStorageDirectory()+/ Android的/数据/ xxx.xxx.xxx /文件/)提到<一个href=\"http://stackoverflow.com/questions/11340853/android-download-file-from-internet-using-downloadmanager-and-save-it-to-the-in\">here,但它不工作。如何解决我的问题?

I am downloading file from a server in Android using the DownloadManager class. I want to store this file in the internal memory of the device. I tried to use .setDestinationInExternalPublicDir(Environment.getExternalStorageDirectory() +"/Android/data/xxx.xxx.xxx/files/") as mentioned here, but it is not working. How to solve my problem?

推荐答案

试试这个

File testDirectory = new File(Environment.getExternalStorageDirectory() +"/Android/data/xxx.xxx.xxx/files/");

if (!testDirectory.exists()) {
    testDirectory.mkdirs();
        }

这篇关于Android的:在使用下载的数据保存到内部存储器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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