I want to create an image picker for Android Lollipop. I use Intent.ACTION_GET_CONTENT
to choose my picture but I cannot get the path of selected image from URI, which the dialog picker returned.
I tried codes from these threads:
retrieve absolute path when select image from gallery kitkat android
https://chintankhetiya.wordpress.com/2013/12/14/picture-selection-from-camera-gallery/
but all of them return null. Can any one help me?
This work for me.
I created a Util class
RealPathUtil
(there are some little differences with the class in the @Artem answer):Then, in my app code, I used:
Make Sure You are Giving Permission in the Android Manifest!
Try
and use:
works for me in must cases (not works for download app)
Try this little function: