In my application I would like to open an image and "load" it to the app using File Manager. I've already doneit using Intent.ACTION_GET_CONTENT
and onActivityResult()
method. Everything works fine, except from the path which I get. It is in a strange format and I can't show the image in ImageView
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == SELECT_PICTURE) {
Uri selectedImageUri = data.getData();
mFileManagerString = selectedImageUri.getPath();
showPreviewDialog(mFileManagerString);
}
}
Here mFileManagerString = /document/image:19552
When I call a method to show the image in the ImageView
:
public void setPreviewIV(String pPath) {
Bitmap bmImg = BitmapFactory.decodeFile(pPath);
receiptPreviewIV.setImageBitmap(bmImg);
}
I get the following error:
E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /document/image:19552: open failed: ENOENT (No such file or directory)
How to get the proper path to the image, so that I can show it in the ImageView
?