I am trying to select multiple files with Intent, but it seems like I'm missing something.
I create an Intent.ACTION_GET_CONTENT Intent, add Intent.EXTRA_ALLOW_MULTIPLE as an extra in the file (seems perfect for the purpose) and create a selector (optional) that selects the application that should be able to select multiple files and return them.
The problem is that I can only select one file.
I tried several file explorers. This is API 18 (4.3).
ACTIVITY_CHOOSE_FILE = 1; //global constant Button btn = (Button) this.findViewById(R.id.btnGetFiles); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent chooseFile; Intent intent; chooseFile = new Intent(Intent.ACTION_GET_CONTENT); chooseFile.setType("file/*"); chooseFile.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); intent = Intent.createChooser(chooseFile, "Choose a file"); startActivityForResult(intent, ACTIVITY_CHOOSE_FILE); } });
I also added this to the manifest (it had the same functionality before adding it):
<intent-filter> <action android:name="android.intent.action.GET_CONTENT" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
Why can't I select multiple files?
(To clarify: the problem is not that several files are not returned - I cannot select more than one file)
android android-intent
Mercylez
source share