如何在Android的手机内存(不是SD卡)中创建文件夹?

编程入门 行业动态 更新时间:2024-10-24 16:24:18
本文介绍了如何在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卡)中创建文件夹?

本文发布于:2023-11-28 06:44:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641346.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   内存   如何在   手机   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!