Shoushou Shoushou - 1 month ago 4
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!


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.