android – How to show only pdf in filepicker?-ThrowExceptions

Exception or error:

I am using this compile('com.droidninja:filepicker:1.0.8') library in my app gradle. How to display only in pdf need to remove other extension.

Github path: https://libraries.io/github/AndroidVinay/Android-FilePicker

How to solve:

As stated in lib documentation :

If you want to add custom file type picker, use addFileSupport() method like this (for pdf support):

       String[] pdfTypes = {".pdf"};
       addFileSupport("PDF", pdfTypes, R.drawable.ic_pdf_icon);

###

    Intent intentPDF = new Intent(Intent.ACTION_GET_CONTENT);
    intentPDF.setType("application/pdf");
    intentPDF.addCategory(Intent.CATEGORY_OPENABLE);
    startActivityForResult(intentPDF, PICK_FILE_PDF);

Leave a Reply

Your email address will not be published. Required fields are marked *