It says here : "When calling the startActivity () method, the system analyzes all installed applications to determine which of them can respond to the Intent object of this type .... .... If the Intent object accepts several operations, the system displays a dialog box where the user can select an application to perform this action. "

There was a question - is it possible to exclude a specific application from the dialog box, if it is installed by the user?

    1 answer 1

    As an option to customize the choice of the application.

    Get the list

    Intent videoIntent = new Intent(android.content.Intent.ACTION_VIEW); videoIntent.setDataAndType(Uri.parse("url"), "video/*"); List<ResolveInfo> video = getPackageManager().queryIntentActivities(videoIntent, 0); ArrayList<String> list = new ArrayList<String>(); for (ResolveInfo info : video){ if(!info.activityInfo.packageName.equals("packageName")){ list.add(info.loadLabel(getPackageManager()).toString()); } } 

    Offer a choice

     AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Select"); builder.setItems(list.toArray(new String[list.size()]), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //... } }); builder.show(); 
    • It will do! Thank you - Mikalai