So I'm trying to allow the user to pick a particular piece of media with my Android Application using the method described here: Access pictures from Pictures app in my android app
It works great, except for the fact that I can seemingly only choose between either Video or Photo to present the user with, not both at the same time. Is there a good way to do this with:
startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), SELECT_IMAGE);
Thanks!
I've used this several times. The best way is something like:
Intent mediaChooser = new Intent(Intent.ACTION_GET_CONTENT);
//comma-separated MIME types
mediaChooser.setType("video/*, images/*");
startActivityForResult(mediaChooser, 1);
Even if this isn't perfectly accurate, it has worked fine in everything I've used it in. It will open up a Gallery-esque activity with a thumbnail list of every picture/video in the user's gallery. The returned intent to onActivityResult()
has an extra called "DATA" which will be a content:// URI to the selected media.
EDIT: oops, to get the URI to the selected media you actually want to call getData() on the Intent that gets passed to onActivityResult()