Tag Archives: gallery

gallery_feature

Hello folks , How are you all , Today I am going to show  you how to pick and call gallery of Android device. For which you have to give the permission in Manifest file i.e. WRITE_EXTERNAL_STORAGE . Lets code and have a look how to code for that.

Download Code

First of all in this example I have setup a method name loadImagefromGallery() in which i have decided to take an Intent to gallery like

Intent galleryIntent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

After selecting an image from gallery view I have returned image from gallery to our activity_main.xml . How lets dig inside –

Lets talk about designing part , i have taken a simple button and imageview to load image.You can customize your code as per your requirements.

activity_main.xml

Now coding part in your Java file you have to paste this code –

MainActivity.java

Now give permission to your Manifest file as follows –

AndroidManifest.xml

Now its time to Run your project and you will see output as follows – This output is of my emulator and emulator does not have any gallery view so output is like this –

OutPut-

pickgallerygallery

Feel free to ask any kind query – Happy coding  :p