2

I am using the following code to choose a picture from gallery.

Intent intent_gallery = new Intent();
intent_gallery.setType("image/*");
intent_gallery.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent_gallery, 1);

However I don't need it to view other applications for choosing pictures. I want it to directely open default gallery instead of showing me other applications for choosing pictures.

Octavian Helm
  • 39,405
  • 19
  • 98
  • 102
Harinder
  • 11,776
  • 16
  • 70
  • 126

2 Answers2

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

            startActivityForResult(intent_gallery, 1);

got it..worked for me!!

Harinder
  • 11,776
  • 16
  • 70
  • 126
  • read [this](http://stackoverflow.com/questions/2507898/how-to-pick-an-image-from-gallery-sd-card-for-my-app-in-android) for getting image – Adem Mar 17 '13 at 13:51
4

This is not possible, it's the users choice with which application he wants to accomplish the task of picking a picture from the gallery. He can check the "Use this as my default application for this task" box, but thats still a user action.

Your only chance would be to hardcode the gallery package name in the intent - which is bad because there are quite a few different gallery apps out there. If the one with the hardcoded package is not present, your app won't work.