Rajat Katiyar
Rajat Katiyar

Reputation: 43

How to add option of "save image to gallery" in share via menu in android?

I am sharing an image to different apps using an intent as ACTION_SEND, but I also want to add an option of "Save image to gallery", in the same menu.

Is there any way to do it ? Please help me somebody. Thanks in advance.

Upvotes: 1

Views: 2085

Answers (1)

Ravi
Ravi

Reputation: 35549

you have to create custom dialog for that. add all ACTION_SEND items to your list and "save image to gallery" option also. put this listview in some dialog.

refer this :

https://github.com/soarcn/BottomSheet

use this code to get available items of ACTION_SEND

    Intent galleryIntent = new Intent(Intent.ACTION_SEND);
    List<ResolveInfo> listGel = context.getPackageManager().queryIntentActivities(galleryIntent, 0);
    for (ResolveInfo res : listGel) {
        Log.e("package",res.activityInfo.packageName);
        Log.e("name",res.activityInfo.name);
        Log.e("proname",res.loadLabel(context.getPackageManager()).toString());


    }

Upvotes: 0

Related Questions