i want to put the image in my email body i have done this
Code :
protected void sendEmail() {
Log.i("Send email", "");
String[] TO = {"tets@gmail.com"};
Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
emailIntent.putExtra(Intent.EXTRA_CC, CC);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Your subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Email message goes here");
Spanned spanned_str_Caution = Html.fromHtml(str_Caution);
String text=tv_viewinfo.getText()+""+spanned_str_Caution;
emailIntent.putExtra(Intent.EXTRA_TEXT, text);
try {
emailIntent.setType("image/png");
int id = getResources().getIdentifier(listimgname.get(0),
"drawable", getPackageName());//my image gets like this
emailIntent.putExtra(Intent.EXTRA_STREAM, id);
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
finish();
Log.i("Finished sending email...", "");
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(View_FoodInfoActivity.this,
"There is no email client installed.", Toast.LENGTH_SHORT).show();
}
catch (Exception e) {
Toast.makeText(View_FoodInfoActivity.this,
e.getMessage(), Toast.LENGTH_LONG).show();
}
how it possible? i want image from drawable folder and want to display in email body... thanks in advance