0

I have created my app which shares an image with text. Right now I want to save an image with text in a variable, but my problem is how to save image with text in another variable by canvas in Android.

That is, I want to share an MMS (image with text) to another app like Whatsapp, but when I use the code below for sharing image and text, only the image is shared. What's missing here to make it share the text as well?

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("sms_body",sheronWall);
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("android.resource://" + getPackageName()
        + "/drawable/" + drawableImageId +"")));
intent.setType("image/gif"); 
startActivity(Intent.createChooser(intent,"Send"));
Loktar
  • 34,764
  • 7
  • 90
  • 104
Shashank Gupta
  • 165
  • 2
  • 16

2 Answers2

0

Use below code for sending text and image by ACTION_SEND

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("image/gif");
    intent.putExtra(Intent.EXTRA_TEXT, "your msg");
    intent.putExtra(Intent.EXTRA_STREAM, "your url");
    startActivity(Intent.createChooser(intent, "Send"));
Divyang Metaliya
  • 1,908
  • 1
  • 12
  • 14
0

In this code sms_body use for MMS and Intent.EXTRA_TEXT use for any other application...

Intent intent = new Intent(Intent.ACTION_SEND);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.setType("image/*"); 
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("android.resource://" + getPackageName()
        + "/drawable/" + drawableImageId +"")));
intent.putExtra("sms_body",sheronWall);
intent.putExtra(Intent.EXTRA_TEXT, sheronWall);
startActivity(Intent.createChooser(intent,"Send"));
Ravi Makvana
  • 2,872
  • 2
  • 24
  • 38