android - Pick Image and Pdf using single intent -


i know can use following

  1. to pick images :intent.settype("image/*");
  2. to pick pdf files :intent.settype("application/pdf");

so there way can pick single entity either pdf or images through single intent?

here example:

private intent getfilechooserintent() {     string[] mimetypes = {"image/*", "application/pdf"};      intent intent = new intent(intent.action_get_content);     intent.addcategory(intent.category_openable);      if (build.version.sdk_int >= build.version_codes.kitkat) {         intent.settype(mimetypes.length == 1 ? mimetypes[0] : "*/*");         if (mimetypes.length > 0) {             intent.putextra(intent.extra_mime_types, mimetypes);         }     } else {         string mimetypesstr = "";          (string mimetype : mimetypes) {             mimetypesstr += mimetype + "|";         }          intent.settype(mimetypesstr.substring(0, mimetypesstr.length() - 1));     }      return intent; } 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -