I'm currently trying to select a specific file type from an SD card or with any application, but I failed, my code looks like this:
Intent intent; if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); else intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("application/pdf|application/msword|application/vnd.openxmlformats-officedocument.wordprocessingml.document" + "|application/vnd.openxmlformats-officedocument.wordprocessingml.template" + "|application/vnd.ms-word.document.macroEnabled.12" + "|application/vnd.ms-word.template.macroEnabled.12" + "!application/vnd.ms-word.template.macroEnabled.12|application/rtf"); startActivityForResult(intent, Constants.ImagePicker.REQ_PICK_RESUME);
but he just selects each type of file.
source share