0

I would like to make a share button for both gmail and the rom email app . The problem is how to share both image and text?

For the image , I can provide either file uri / bitmap / whatever need and I only need to share one image.

   final Intent result = new Intent(android.content.Intent.ACTION_SEND);
    result.setType("plain/text");
    result.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { recipient });
    result.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
    result.putExtra(android.content.Intent.EXTRA_TEXT, body);

Thanks for helping

user782104
  • 13,233
  • 55
  • 172
  • 312
  • check this tutorial this might help https://hasithdevs.wordpress.com/2013/01/10/android-share-textimages-using-share-intent/ – dlohani Feb 26 '15 at 11:36
  • also check this http://stackoverflow.com/questions/8296605/problems-sharing-combined-text-and-image-with-share-intent-on-twitter – dlohani Feb 26 '15 at 11:37

1 Answers1

3

You can find ans from below code:

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
emailIntent.setType("image/jpeg");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {""}); 
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, EMAIL_SUBJECT); 
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, EMAIL_BODY);
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+fileName));
startActivity(Intent.createChooser(emailIntent, "Sharing Options"));

Hope this helps..