Skip to content Skip to sidebar Skip to footer

Error Getting Image Path Selected By Gallery Intent (android 6 - Some Devices)

I am trying to get the path of an image when the user pick from the gallery (with intent) It's been working ok, since some users noticed that could not do it witn Android 6.0. I ha

Solution 1:

I'm asking for choose an image in this way:

First, use ACTION_GET_CONTENT to pick by MIME type.

Second, whatever activity that responds to ACTION_GET_CONTENT (or ACTION_PICK) does not need to return a Uri that the MediaStore knows about. In fact, most will not. They can return a Uri that points to anything, including things that are not files.

So, get rid of all of your broken getRealPathFromURI() code. Use ContentResolver and openInputStream() to get an InputStream on the content identified by the Uri, and use that stream.

Post a Comment for "Error Getting Image Path Selected By Gallery Intent (android 6 - Some Devices)"