1

I Try code for a open Documentation File but Also it's take a .apk File

How to avoid .apk extension Other wise This code work perfect to select other document

See Below Code for a Open Documentation File:

@Override
    public void onClick(View v) {

        switch (v.getId()){

            case R.id.rlSelectFile:
                Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
                intent.addCategory(Intent.CATEGORY_OPENABLE);
                intent.setType("application/x-excel|application/pdf|text/plain|text/csv|image/*");
                //intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
                startActivityForResult(intent, 1);
                /*Intent intent = new Intent(Intent.ACTION_PICK);
                startActivityForResult(intent,1);*/
                break;
        }
    }

Not Only .apk but also How to avoid any Extension

Ali
  • 3,346
  • 4
  • 21
  • 56
  • I don't have any idea why use `mimeType` so i put this line in a comment. I'll Just a paste this code it's work file but it's also select a .apk file but i not need to catch a .apk file @pskink – Ali Mar 31 '18 at 10:25
  • @MohammadAli Do you know have the file details before opening? – udit7395 Mar 31 '18 at 10:29
  • No but i need only avoid .apk file @udit7395 – Ali Mar 31 '18 at 10:31
  • By file details I mean the file name and path ? – udit7395 Mar 31 '18 at 10:32
  • When i open a my folder it's show pdf, txt, excel, apk etc or Image or some other extension it can't show @udit7395 – Ali Mar 31 '18 at 10:34

0 Answers0