Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Commit

Permalink
Always set multiple URIs in StringExtras
Browse files Browse the repository at this point in the history
  • Loading branch information
spacecowboy committed Oct 22, 2016
1 parent 1d40d6b commit 4fef8f8
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ public void onFilesPicked(@NonNull final List<Uri> files) {
Intent i = new Intent();
i.putExtra(EXTRA_ALLOW_MULTIPLE, true);

// Set as String Extras for all versions
ArrayList<String> 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) {
Expand All @@ -153,12 +161,6 @@ public void onFilesPicked(@NonNull final List<Uri> files) {
}
}
i.setClipData(clip);
} else {
ArrayList<String> paths = new ArrayList<>();
for (Uri file : files) {
paths.add(file.toString());
}
i.putStringArrayListExtra(EXTRA_PATHS, paths);
}

setResult(Activity.RESULT_OK, i);
Expand Down

0 comments on commit 4fef8f8

Please sign in to comment.