简体   繁体   English

/storage/emulated/0/Notes/(没有那个文件或目录)?

[英]/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.

相关问题 Android - java.io.FileNotFoundException: /storage/emulated/0/Notes/File.txt: open failed: ENOENT (No such file or directory) - Android - java.io.FileNotFoundException: /storage/emulated/0/Notes/File.txt: open failed: ENOENT (No such file or directory) java.io.FileNotFoundException: /storage/emulated/0/Notes/fact50Result.txt: open failed ENOENT (No such file or directory) - java.io.FileNotFoundException: /storage/emulated/0/Notes/fact50Result.txt: open failed ENOENT (No such file or directory) 存储/模拟/ 0 /打开失败:ENOENT(没有这样的文件或目录)? - storage/emulated/0/ open faild:ENOENT (no such file or directory)? FileNotFoundException:/storage/emulated/0/JsonParseTutorialCache:打开失败:ENOENT(没有这样的文件或目录) - FileNotFoundException: /storage/emulated/0/JsonParseTutorialCache: open failed: ENOENT (No such file or directory) DocumentException:/storage/emulated/0/droidText/ciccia.pdf:打开失败:ENOENT(无此类文件或目录) - DocumentException:/storage/emulated/0/droidText/ciccia.pdf: open failed: ENOENT (No such file or directory) java.io.FileNotFoundException: /storage/emulated/0/MyPDFDocument/questions.pdf(没有这样的文件或目录) - java.io.FileNotFoundException: /storage/emulated/0/MyPDFDocument/questions.pdf (No such file or directory) 在“/storage/emulated/0/Pictures/”中找不到文件 - File not found inside "/storage/emulated/0/Pictures/" Android/Java:I/System.out:错误:java.io.FileNotFoundException:/storage/emulated/0/hermaps/...:打开失败:ENOENT(没有这样的文件或目录) - Android/Java: I/System.out: Error :java.io.FileNotFoundException: /storage/emulated/0/heremaps/...: open failed: ENOENT (No such file or directory) java.io.FileNotFoundException:/storage/emulated/0/Android/data/MyApplication/MyFile.ics。 (没有这样的文件或目录)/ Android Studio / Ical4j - java.io.FileNotFoundException: /storage/emulated/0/Android/data/MyApplication/MyFile.ics. (No such file or directory) / Android Studio / Ical4j 如何在android中创建外部存储目录,将外部存储路径显示为“storage / emulated / 0”? - How to create directory in external storage in android which show external storage path as “storage/emulated/0”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM