Select multiple files with Intent.ACTION_GET_CONTENT
I got same issue. Here my solution.
Java:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data)
if(requestCode == PICKFILE_RESULT_CODE) {
if(null != data) { // checking empty selection
if(null != data.getClipData()) { // checking multiple selection or not
for(int i = 0; i < data.getClipData().getItemCount(); i++) {
Uri uri = data.getClipData().getItemAt(i).getUri();
}
} else {
Uri uri = data.getData();
}
}
}
}
Kotlin:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
PICKFILE_RESULT_CODE -> if (resultCode === Activity.RESULT_OK) {
if (null != data) {
if (null !=data.clipData) {
for (i in 0 until data.clipData.itemCount) {
val uri = data.clipData.getItemAt(i).uri
dumpImageMetaData(uri)
}
} else {
val uri = data.data
dumpImageMetaData(uri)
}
}
}
}
}
Why can't I choose multiple files?
Presumably, the implemeters of "the application that should be able to pick multiple files and return them" have not implemented EXTRA_ALLOW_MULTIPLE
support. Contact them and request this feature.