开发者

Android Inline Images in Email

开发者 https://www.devze.com 2023-01-25 03:12 出处:网络
Any one can suggest how to add images in email body ? I tried it, but no answer. Here is my code: Intent sendIntent = new Intent(Intent.ACTION_SEND);

Any one can suggest how to add images in email body ? I tried it, but no answer.

Here is my code:

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/jpeg");
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "gmail@gmail.com" });
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Photo");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + _path));
sendIntent.setType("i开发者_Python百科mage/png;text/html");

String htmlecode = 
    "<html><b>Bold Text works perfectly</b>" +
    "<img width='48' height='48' alt='' " +
    "src='http://upload.wikimedia.org/wikipedia/commons/7/7a/Basketball.png' />" +
    "</html>";

sendIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(htmlecode, imgGetter, null));

startActivity(Intent.createChooser(sendIntent, "Email:"));

wat's wrong in this code ?


There is a similar post here. They suggest using:

emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/Myimage.jpeg"));
0

精彩评论

暂无评论...
验证码 换一张
取 消