0

I have my images in drawable folder and I am getting that images in gridview.Also I am showing the perticular image on selection fullscreen.Now I want to send MMS with image attachment.

Here is my code to show the image. And to send MMS.how to get Uri to put to intent or how to send the image attachment.

imageView.setImageResource(imageAdapter.mThumbIds[position]);



Intent sendIntent = new Intent(Intent.ACTION_SEND);
             sendIntent.putExtra("sms_body", "Hii");
             sendIntent.setType("image/png");

             startActivity(sendIntent);
user1758835
  • 215
  • 4
  • 17
  • look at this ..http://jtribe.blogspot.in/2008/12/sending-mms-with-android.html – itsrajesh4uguys Mar 05 '13 at 10:49
  • How to get the path or Uri to add it to intent for example sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(targetPath))); but i want it from drawable – user1758835 Mar 05 '13 at 10:50

1 Answers1

0

Use the following code to send the mms.. Hope this wil help you.

 Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra("sms_body", "Hi how are you");
    intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/file.gif")));
    intent.setType("image/gif"); 
    startActivity(Intent.createChooser(intent,"Send"));



Uri uri = Uri.parse("android.resource://your.package.here/drawable/image_name");

EDIT:

Intent intent = new Intent(Intent.ACTION_SEND);
        intent.putExtra("sms_body", "Hi how are you");
        Uri uri = Uri.parse("android.resource:// com.example.stack/drawable/ic_launcher.png");
        intent.putExtra(Intent.EXTRA_STREAM,uri );
        intent.setType("image/png"); 
        startActivity(Intent.createChooser(intent,"Send"));
itsrajesh4uguys
  • 4,610
  • 3
  • 20
  • 31