如何在Android的手机内存(不是SD卡)中创建文件夹? [英] How to create a folder in the phone memory (not SD card) in Android?
本文介绍了如何在Android的手机内存(不是SD卡)中创建文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试了以下代码来实现我所需要的
I tried the following code to implement what I need
File direct = new File(Environment.getRootDirectory() + "/YourFolder");
if (!direct.exists()) {
if (direct.mkdir()) {
Toast.makeText(getApplicationContext(), "Yes make directory", Toast.LENGTH_LONG).show();
}
else
{
Toast.makeText(getApplicationContext(), "No make directory", Toast.LENGTH_LONG).show();
}
}
我还在AndroidManifest.xml文件中添加了以下权限
I also added the following permission in the AndroidManifest.xml file
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
但是它不起作用.它仅显示吐司消息无目录" .
But it doesn't work. It just displays the toast message "No make directory".
任何人都可以建议我要去哪里哪里或提出另一种方法来实现相同的目的吗?
Can anyone suggest where I am going wrong or propose an alternate method to implement the same?
推荐答案
您可以点击此链接
希望以上链接对您有所帮助.
hopefully you are helpful from above link.
祝你好运!
这篇关于如何在Android的手机内存(不是SD卡)中创建文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文