I am trying to open an image / picture in the Gallery built-in app from inside my application.
I have a URI of the picture (the picture is located on the SD card).
Do you have any suggestions?
I am trying to open an image / picture in the Gallery built-in app from inside my application.
I have a URI of the picture (the picture is located on the SD card).
Do you have any suggestions?
This is a complete solution. I've just updated this example code with the information provided in the answer below by @mad. Also check the solution below from @Khobaib explaining how to deal with picasa images.
Update
I've just reviewed my original answer and created a simple Android Studio project you can checkout from github and import directly on your system.
https://github.com/hanscappelle/SO-2169649
(note that the multiple file selection still needs work)
Single Picture Selection
With support for images from file explorers thanks to user mad.
Selecting Multiple Pictures
Since someone requested that information in a comment and it's better to have information gathered.
Set an extra parameter
EXTRA_ALLOW_MULTIPLE
on the intent:And in the Result handling check for that parameter:
Note that this is only supported by API level 18+.
Quickest way to open image from gallery or camera.
Original reference : get image from gallery in android programmatically
Following method will receive image from gallery or camera and will show it in an ImageView. Selected image will be stored internally.
code for xml
JAVA class
Here is an update to the fine code that hcpl posted. but this works with OI file manager, astro file manager AND the media gallery too (tested). so i guess it will work with every file manager (are there many others than those mentioned?). did some corrections to the code he wrote.
Additional to previous answers, if you are having problems with getting the right path(like AndroZip) you can use this:
Please find the answer for the selecting single image from gallery