Android: Let user pick image or video from Gallery

Asahi picture Asahi · Feb 7, 2011 · Viewed 49k times · Source

Is it possible to to start Gallery in such a way so both pictures and videos are shown?

Thanks

Answer

Jorgesys picture Jorgesys · Apr 9, 2014

Pick Audio file from Gallery:

//Use MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);

Pick Video file from Gallery:

//Use MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI);

Pick Image from gallery:

//Use  MediaStore.Images.Media.EXTERNAL_CONTENT_URI
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

Pick Media Files or images:

 Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("image/* video/*");