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.setType("image/*"); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Picture"); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(lstPhotos.get(newPosition).getPhotoURL())); 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