Skip to content

Instantly share code, notes, and snippets.

@kingargyle
Created October 19, 2015 18:15
Show Gist options
  • Save kingargyle/e9c3ce694027319b4e7f to your computer and use it in GitHub Desktop.
Save kingargyle/e9c3ce694027319b4e7f to your computer and use it in GitHub Desktop.
Android 4.4+ Select Multiple Files with UI File Picker
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
// In code that handles the result returned to process the files:
ClipData clipData = intent.getClipData();
if (clipData != null) {
clipData.getItemCount();
}
// All data is returned in the ClipData object and item count contains the number of items returned.
// Content is the URI for each file to be resolved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment