Attaching selected image to email in android

I have a list of Drawable images in my application and would like to send one of the images via mail. my code looks like

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Picture");                       
myActivity.startActivity(Intent.createChooser(sendIntent, "Email:"));


But in the above code, I have a problem as I cannot get the image URI from the drawables list. Can anyone help me how to send the image, because if I use the above code, I get an empty image of the 0kb uploaded.


source to share

1 answer

You can do this by storing this image to a temporary location in the internal / external cache directory as an image and then use that image path in your application using a Uri .



All Articles