Shoushou Shoushou - 2 months ago 19
Android Question

Android decode file returns null

I have the following code:

Bitmap b= BitmapFactory.decodeFile(imagePath);


where the imagPath value is /external/images/media/43426 (I read it by allowing the user to select the image from the phone using this code:

Uri selectedImage = imageReturnedIntent.getData();
imagePath = selectedImage.toString();


The problem is that b is always null ! I have added the permission for READ_EXTERNAL_STORAGE, and tried many solutions found on the net but no success!

Answer

where the imagPath value is /external/images/media/43426

That is not how to use a Uri, particularly one with a content scheme, as yours has.

Either:

Comments