Check Mobile App
Read now

Pick image from gallery in Android

Save

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.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


5 comments

  • Agrit Tyagi
    Nicely Done
  • Vijay
    thanks. It Worked
  • Pandga
    Thanks! That helped me.
  • Aditi
    why do we need this :
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    It works even without this line.Could you tell what this line actually means?
    And what should we actually specify as action?
    Intent.ACTION_GET_CONTENT or Intent.ACTION_PICK or Intent.ACTION_OPEN_DOCUMENT?
  • Jaimin Patel
    Very Much Thank u for this code ..
    Was Really much helpful to get the path…
  • css.php

    Very responsive and a great developer. We ordered a lot of modules and a mobile application. Did everything efficiently and quickly. Thank you for Your support. We are glad to cooperate with You.

    Лариса

    Лариса

    Great developers.

    Talk to Sales

    Global

    Live Chat
    Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home