I’m trying to select file with intent Intent.ACTION_OPEN_DOCUMENT
. Here is my code:
ActivityResultLauncher<String[]> launcher = registerForActivityResult(new ActivityResultContracts.OpenDocument(), uri -> {
if (uri != null) {
}
});
And then:
launcher.launch(mimeTypes);
This works, however I would like to only allow the user to select one file. But at the moment, when the file explorer opens, the user can select multiple files. I would like to disable multiple selection, is this possible?
Please, help me.