From 4fef8f829a6e1f9cddc8b2281f710966db35b8c6 Mon Sep 17 00:00:00 2001 From: Jonas Kalderstam Date: Sat, 22 Oct 2016 17:18:28 +0200 Subject: [PATCH] Always set multiple URIs in StringExtras --- .../filepicker/AbstractFilePickerActivity.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerActivity.java b/library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerActivity.java index a8155798..e39aeddc 100644 --- a/library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerActivity.java +++ b/library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerActivity.java @@ -142,6 +142,14 @@ public void onFilesPicked(@NonNull final List files) { Intent i = new Intent(); i.putExtra(EXTRA_ALLOW_MULTIPLE, true); + // Set as String Extras for all versions + ArrayList paths = new ArrayList<>(); + for (Uri file : files) { + paths.add(file.toString()); + } + i.putStringArrayListExtra(EXTRA_PATHS, paths); + + // Set as Clip Data for Jelly bean and above if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { ClipData clip = null; for (Uri file : files) { @@ -153,12 +161,6 @@ public void onFilesPicked(@NonNull final List files) { } } i.setClipData(clip); - } else { - ArrayList paths = new ArrayList<>(); - for (Uri file : files) { - paths.add(file.toString()); - } - i.putStringArrayListExtra(EXTRA_PATHS, paths); } setResult(Activity.RESULT_OK, i);