androidimagecontextmenushare

Prevent auto choose which sharing application use


I'm develop an application in Android.

I have a ListView with some image, when I click a row I open ContextMenu and I have two choices, eliminate the image or sharing with other application.

    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_SEND);
    intent.setType("image/*");
    Uri r = Util.getImageUri(getActivity().getApplication(), image);
    intent.putExtra(Intent.EXTRA_STREAM, r);
    startActivity(intent);

I use this code to sharing the image, but after the first time, every time that I try to share image, the application always chooses the first application with which I sent the first image.

How can I prevent it? I want that user chooses every time the sharing application. Thanks.


Solution

  • I use this code to sharing the image, but after the first time, every time that I try to share image, the application choose always the first application with wich I send the first image.

    That was because you indicated, to the chooser, that you wanted to make this choice "always", instead of "just once".

    I want that user choose every time sharing application

    Use:

    startActivity(Intent.createChooser(intent, "..."));
    

    where "..." is your explanation for this.