I am uploading selected file to server but i know i wanna restrick user to pick only document file(.doc , .pdf etc) and image file.
For now my code is working for all files it fetches uri of all files, So please tell me how to restrict user pick only specific type of file.
Here is my code to pick any file.
Intent i=new Intent();
i.setType("*/*");
i.setAction(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(Intent.createChooser(i, "abc"),requestCode);
Pass multiple MIME types separate with
|
likeor create an array of MIME types like
and pass it as
Though not through an Intent but I have found a good library project by droidninja that enables one to browse through doc files or images stored locally in a single go.
then call this below given function to have a material themed dialog box which will give one an option to choose whether to choose an images or group or same with docs
finally, onActivityResult() will be called to extract the result something like this
AppTheme