Android: PDF files hidden despite setting the MIME type
Asked Answered
S

2

7

This is my Intent:

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("text/* , application/pdf, image/*");

But, when the file explorer shows up, the PDF files are grayed out i.e., un-choosable. Is there any workaround for this?

Sextuplicate answered 11/4, 2016 at 4:55 Comment(0)
B
11

If you are using minimum Android version 19 then you can do this below way

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent .setType("*/*");
String[] mimeTypes = {"image/*", "application/pdf"};
intent .putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
Bates answered 15/4, 2016 at 14:8 Comment(0)
P
2

Try

intent.setType("text/*|application/pdf|image/*");
Planimetry answered 11/4, 2016 at 5:31 Comment(1)
Tried it, still see the PDF files greyed outSextuplicate

© 2022 - 2024 — McMap. All rights reserved.