简体   繁体   中英

File not found inside "/storage/emulated/0/Pictures/"

I am accessing a file from " /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.

Whenever I use " 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 .

And if you want to use your private application pictures directory use context.getExternalFilesDir(Environment.DIRECTORY_PICTURES) , where context is Android Context

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM