Search code examples
androidimageandroid-gallery

How to get the image id of an image in the Android gallery?


Here is what I am trying to do in one of my activities:

  1. Open up the Android Gallery. (Done)

  2. When clicking on one of the images in the gallery I want to

    • Get the ID of that image (????)
    • Save the Image to the SharedPreferences (Already know how to do that)
    • Display the image in an ImageView (Already know how to do that)

So how do I get the ID from an image in the gallery?

P.S.: Is that approach of displaying an image ok like that?


Solution

  • here are some examples of how to pick an image in the gallery:

    1. How To Pick Image From Gallery
    2. Android Gallery display selected image

    hope that you'll get idea from these links.