Redeem Now
Read More
Read now

Pick image from gallery in Android


Here I am showing you how to get an image from your phone gallery. We use intents to open up the image gallery and get the image URI.

Add Permission in Android Manifest.

On click of the  button, start startActivityForResult as follows:

Above code, the segment is used to choose an image from Gallery.

Once we will select an image, the method OnActivityResult()  will be called. We need to handle the data in this method as follows:

Get the real path from the URI

Thanks for reading.

. . .

Comments (2)

Add Your Comment

  • Agrit Tyagi
    Nicely Done
  • Aditi
    why do we need this :
    It works even without this line.Could you tell what this line actually means?
    And what should we actually specify as action?
  • css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again