I have this intent for let user choose images:
fun launchChooseFileIntent(callerFragment: BaseFragment, REQUEST_CODE: Int) {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = "image/*,"
}
startActivityForResult(intent, REQUEST_CODE)
}
Now i need that user can choose both images and pdf documents. I've try to change type string like
type = "image/*,application/pdf"
or like
type = "image/*|application/pdf"
but it doesn't work.
I've try also to add extra to intent like
putExtra(Intent.EXTRA_MIME_TYPES, arrayOf("image/*", "application/pdf"))
but the app crash.
How can i solve it?