1

I am trying to open Documents and Images both at same time, I have used SetType method to open Image and PDF, but both of them can't be opened at same time. Is there any solution to open at same time? Here I have posted sample code.

 Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
 intent.setType("image/*");
 intent.setType("application/pdf/*");
a_local_nobody
  • 7,947
  • 5
  • 29
  • 51
Chanchal Shakti
  • 153
  • 1
  • 8
  • 3
    Does this answer your question? [Multiple MIME types in Android](https://stackoverflow.com/questions/1698050/multiple-mime-types-in-android) – Hamid Rasti Feb 19 '21 at 08:11

1 Answers1

1

Try this

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent .setType("*/*");
String[] mimeTypes = {"image/*", "application/pdf"};
intent .putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);

Then define the type based on the returned result.

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108