1

I am using below code to select the file from device

Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
startActivityForResult(intent,1212);

The above code give below output

sample out put

Is there any way to remove or filter the apps shown in dialog? for e.g. I want to remove both com.android.contacts from the dialog.

Rahul Matte
  • 1,151
  • 2
  • 23
  • 54
  • `ACTION_PICK` does not use MIME types, but rather a data `Uri`. Use `ACTION_GET_CONTENT` or `ACTION_OPEN_DOCUMENT` to allow the user to choose content by MIME type. – CommonsWare May 31 '16 at 13:48
  • Thank you Mark sir, but problem with ACTION_GET_CONTENT, it shows Dropbox, drive, etc even after adding intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); – Rahul Matte May 31 '16 at 13:56
  • Sure. That's because those are valid options for the user. There is no magic way to say "I only want file choosers", as "file chooser" is a marketing term, not a technical one. – CommonsWare May 31 '16 at 13:58
  • 1
    there won't be any option to disable Dropbox,drive, apps..? – Rahul Matte May 31 '16 at 14:00

1 Answers1

1

The intent type Intent.ACTION_PICK makes the app to open all other apps which are capable of doing the action Intent.ACTION_PICK. I have noticed it when I removed photos app, it's option was not showing in above popup.

Rahul Matte
  • 1,151
  • 2
  • 23
  • 54