[英]/storage/emulated/0/Notes/ (No such file or directory)?
I tried this link:我试过这个链接:
How to create text file and insert data to that file on Android 如何在 Android 上创建文本文件并将数据插入该文件
But, it says "No such file or directory".但是,它说“没有这样的文件或目录”。 Can anybody help me please?
有人可以帮我吗? Thanks in advance!
提前致谢!
---- Updated answer---- ---- 更新答案----
I think you can't create a directory inside the internal storage of the device.我认为您无法在设备的内部存储中创建目录。 Except you've a root access for the app.
除非您拥有该应用程序的根访问权限。 You can only create the directory inside your app private folder within the following path String
path = getFilesDir().
您只能在以下路径 String
path = getFilesDir().
内的应用程序私有文件夹中创建目录path = getFilesDir().
you can use like this below -你可以像下面这样使用 -
File mydir = context.getDir("mydirectory", Context.MODE_PRIVATE); //Creating an internal dir;
File fileWithinMyDir = new File(mydir, "myAwesomeFile"); //Getting a file within the dir.
FileOutputStream out = new FileOutputStream(fileWithinMyDir); //Use the stream as usual to write into the file.
getDir(StringName, int mode)
method to create or access directories in internal storage. getDir(StringName, int mode)
方法来创建或访问内部存储中的目录。
/storage/emulated/0/Notes/ will always return No such file or directory
except device is rooted and dir.mkDirs()
will always return false for this path. /storage/emulated/0/Notes/ 将始终返回
No such file or directory
除了设备是 root 并且dir.mkDirs()
将始终为此路径返回 false 。
Hope this will help you.希望这会帮助你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.