Search code examples
androidandroid-intentsharesave-image

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.


Solution

  • 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());
    
    
        }