I am uploading files like pdf,ppt,doc etc to server using from my android app but in marshmallow when file chooser opens and i browse my Sdcard or internal storage there are two problmes :
1. it shows all files like images,videos and documents etc which i cannot pick but i used intent type as application/pdf; appkication/ppt etc.,so it should let me pick those files.
2. secondly when i use external file manager like ES file explorer etc it then show all files like images,videos,documents,apks and this time it lets me choose any type of file
here is my code for file chooser
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("application/pdf;application/docx;application/xlsx;application/pptx;application/pptx;application/txt");
startActivityForResult(intent, PICK_FILE_REQUEST);
i am using marshmallow and i think it happens only in marshmallow as i dont have other devices earby to test this code on so help me here Thanks
i tried it like this
intent.setType("application/pdf|application/docx|application/xlsx|application/pptx|application/txt");
but it didnt let me chose any file but if i use only one MIME type like pdf or docx then it works and let me pick pdf or docx and i searched across internet and found this way to use multiple MIME type that is by using | instead of ; and for most of users it works fine but dont for me.