Multiple MIME types in Android

In Android 4.4 when using the Storage Access Framework you can use the EXTRA_MIME_TYPES to pass multiple mime types.

Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
String[] mimetypes = {"image/*", "video/*"};
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
startActivityForResult(intent, REQUEST_CODE_OPEN);

Leave a Comment