0

how to share image and text both on gmail? here is my code but it can,t work.

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/png");
Uri uri = Uri.parse("android.resource://pakage name/"+R.drawable.image13);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.putExtra(Intent.EXTRA_TEXT, data );
startActivity(Intent.createChooser(shareIntent, "Send your image"));
Hariharan
  • 24,741
  • 6
  • 50
  • 54
  • check out my answer http://stackoverflow.com/a/20015435/1839336 and in code set the type as `shareIntent.setType("*/*");` – GrIsHu Jun 26 '14 at 05:07
  • possible duplicate of [Android send email with text and images](http://stackoverflow.com/questions/8109877/android-send-email-with-text-and-images) – Haresh Chhelana Jun 26 '14 at 05:15

1 Answers1

0

Try using "*/*" as MIME, so you can send any generic data type.

Therefore to send image and text,use below code

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);

    shareIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emailaddress); // if you want to add email address also.
    shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, data);
    shareIntent.setType("*/*");

    ArrayList<Uri> uris = new ArrayList<Uri>();

    uris.add(Uri.parse("android.resource://" + getPackageName() + "/" + R.drawable.image13));

    shareIntent.putExtra(Intent.EXTRA_STREAM, uris);

    startActivity(Intent.createChooser(shareIntent, "Send your image"));
Giru Bhai
  • 14,370
  • 5
  • 46
  • 74