我们怎样才能为我们的应用程序的新文件夹,我们可以保存下载数据 [英] How can we create a new folder for our app where we can save the downloaded data

查看:138
本文介绍了我们怎样才能为我们的应用程序的新文件夹,我们可以保存下载数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发下载MP 3个文件的应用程序。我想知道如何创建我的应用程序一个新的文件夹在我的Andr​​oid的文件可见,并保存所有下载的文件进去。

I am developing an app that downloads the MP 3 files. I want to know how to create a new folder for my app that is visible in MY FILES of android and saves all the downloaded files into it.

推荐答案

你的意思是这样的:

File theDirectory = new File("/sdcard/yourdir/");
theDirectory.mkdirs();
File outputFile = new File(theDirectory, filename);

此外,您可能需要使用<一个href=\"http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory%28%29\"相对=nofollow> Environment.getExternalStorageDirectory()并添加:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

这篇关于我们怎样才能为我们的应用程序的新文件夹,我们可以保存下载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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