Monday, September 16, 2013

FileNotFoundException when accessing file stored at /storage/emulated/0 in Android

I am keep getting this error on my Android Nexus 4 device and it is becoming a headache now. Even though I have permission to access SDCard still my application can not read images from the galley.

If you take a picture from the Android camera path is saved as /storage/emulated/0/DCIM/... and when my app try to read this file from it throws FileNotFoundException  error. Weird... To fix this

I did this

String path = path .replace(“/storage/emulated/0″, “/sdcard”); 

and it worked!