0

I want to use the user to select an image using the default gallery app. I don't want him to choose between apps, I want the default app to open.

I use this code

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

but it keeps showing me list of apps to choose from. Can I force it to go default ( Gallery app) all the time?

Thank you

Snake
  • 14,228
  • 27
  • 117
  • 250
  • see http://stackoverflow.com/a/18780533/794088 – petey Dec 21 '13 at 22:52
  • 1
    If your users want to pick an image from some other app, please let them. – CommonsWare Dec 21 '13 at 22:56
  • I'm really glad that Android does not permit this. I will choose what apps I use, not you! – Simon Dec 21 '13 at 22:57
  • The reason is, because I want to know what image they picked. The gallery app returns a path, but if the user choose another app, I dont know how to get the image they picked – Snake Dec 21 '13 at 23:08
  • You get the image the same way you get anything from `ACTION_GET_CONTENT`: via the `Uri` in the `Intent` delivered to `onActivityResult()`. "The gallery app returns a path" -- no, it does not. It returns a `Uri`. That `Uri` should be a `content://` `Uri`. It does not have to resolve to an actual file anywhere that you can reach (e.g., the image is in a database, the image is in internal storage, the image is on removable storage). Moreover, there are thousands of Android device models, containing dozens, if not hundreds, of "gallery apps", not just one. – CommonsWare Dec 22 '13 at 01:25
  • Thank you. Sorry I meant URI (I always think of it as a file which is wrong I guess). So if someone selects an image using "file manager" or any other 3rd party app, I will always be getting URI in the OnActivityResult? If thats the case then no need for forcing the user – Snake Dec 22 '13 at 01:39
  • @Snake why don't you try yourself and see what other apps give? – Rohan Kandwal Dec 22 '13 at 04:45

0 Answers0