I tried this
private void postImage(Uri uri) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
inte
Now my problem is i need the application name on which this image is shared
If your minSdkVersion
is 22 or higher, use the createChooser() that takes an IntentSender as the third parameter, as that is your only means of finding out what the user chose.
If your minSdkVersion
is below 22, you will have to create your own chooser-style UI, using PackageManager
and queryIntentActivities()
to find out what activities should be listed in that UI.
I also created my custom dialog for it but problem remains same
You certainly know what the user chose in the dialog. That is all you are going to get from the API Level 22 createChooser()
either.
Because when i select an option for share like facebook and i pressed back button then image is not share and i only know that the user click on facebook.
Of course. The user can do whatever the user wants in that other application. The user does not have to press BACK; the user can simply fail to send anything. That is between the user and that application — information about whether the user did anything, who the user shared the information with, and so on, is not available to you.