Search code examples
androidandroid-intentfilepicker

remove bug report option from file picker - File Picker Intent - android


I have created Intent to choose any file like this:

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");

After that i have added below lines to select local file only and remove irrelevant app like Drive etc

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
}

After that i have added below lines for single file selection

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);
}

After that i have added below line to remove irrelevant app like Contacts or any other

intent.addCategory(Intent.CATEGORY_OPENABLE);

At last

context.startActivityForResult(intent, REQUEST_PICK_ANY_FILE);

Problem 1: Still default File Picker in android is shows "Bug Report" option, how can i remove that option. (Tested in Nexus 5x - android 7)

Problem 2: File Picker shows Hidden files, how can i enable or disable hidden files so that it's selection can be enabled or disabled (Tested in Nexus 5x - android 7)


Solution

  • As commented by CommonsWare the right answer is, There is no such Intent. Android focuses on content coming from arbitrary locations, not files on the filesystem. Either use a library, create your own file-browsing UI.