Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: PDF files hidden despite setting the MIME type

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?

like image 453
Faux Pas Avatar asked Apr 11 '16 04:04

Faux Pas


2 Answers

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);
like image 187
mohit Avatar answered Oct 28 '22 15:10

mohit


Try

intent.setType("text/*|application/pdf|image/*");
like image 2
F43nd1r Avatar answered Oct 28 '22 15:10

F43nd1r