简体   繁体   English

在“/storage/emulated/0/Pictures/”中找不到文件

[英]File not found inside "/storage/emulated/0/Pictures/"

I am accessing a file from " /storage/emulated/0/Pictures/1565704523555.jpg ".我正在访问来自“ /storage/emulated/0/Pictures/1565704523555.jpg ”的文件。 When I check if the file exists it tells me that the file was not found.当我检查文件是否存在时,它告诉我未找到该文件。
I have given all run-time permissions.我已授予所有运行时权限。

When I list all files from " /storage/emulated/0/Pictures/ " I can see the file in that directory.当我列出“ /storage/emulated/0/Pictures/ ”中的所有文件时,我可以看到该目录中的文件。

Whenever I use " Environment.getExternalStorageDirectory().toString()+/Pictures "每当我使用“ Environment.getExternalStorageDirectory().toString()+/Pictures
I can access all the files from this folders and it shows that the file exists.我可以访问此文件夹中的所有文件,并且显示该文件存在。

I am trying this on an emulator.我正在模拟器上尝试这个。

Use Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) instead of Environment.getExternalStorageDirectory().toString()+/Pictures .使用Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)而不是Environment.getExternalStorageDirectory().toString()+/Pictures

And if you want to use your private application pictures directory use context.getExternalFilesDir(Environment.DIRECTORY_PICTURES) , where context is Android Context如果您想使用您的私有应用程序图片目录,请使用context.getExternalFilesDir(Environment.DIRECTORY_PICTURES) ,其中context是 Android Context

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 /storage/emulated/0/Notes/(没有那个文件或目录)? - /storage/emulated/0/Notes/ (No such file or directory)? 存储/模拟/ 0 /打开失败:ENOENT(没有这样的文件或目录)? - storage/emulated/0/ open faild:ENOENT (no such file or directory)? java.lang.IllegalArgumentException:无法找到包含/ storage / emulated / 0 / Pictures的已配置根目录 - java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Pictures java.lang.IllegalArgumentException:无法找到包含/ storage / emulated / 0 / Pictures /的已配置根目录 - java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Pictures/ FileNotFoundException:/storage/emulated/0/Pictures/pic.jpg:打开失败:EACCES(权限被拒绝) - FileNotFoundException: /storage/emulated/0/Pictures/pic.jpg: open failed: EACCES (Permission denied) FileNotFoundException:/storage/emulated/0/JsonParseTutorialCache:打开失败:ENOENT(没有这样的文件或目录) - FileNotFoundException: /storage/emulated/0/JsonParseTutorialCache: open failed: ENOENT (No such file or directory) 模拟外部存储android - emulated external storage android listFiles() 在 /storage/emulated 上返回 null,而 /storage/emulated/0 存在 - listFiles() returns null on /storage/emulated, while /storage/emulated/0 exists Android 9 无法在 Android 外部公共路径中创建目录(“storage/emulated/0/MyImages”) - Android 9 can't create directory inside Android external public path("storage/emulated/0/MyImages") Android Studio,/ storage / emulated / 0不存在 - Android studio, /storage/emulated/0 not exist
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM