2010-11-16 71 views
4

任何人都可以建議如何在電子郵件正文中添加圖像? 我試過了,但沒有回答。電子郵件中的Android Inline圖像

這裏是我的代碼:

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
sendIntent.setType("image/jpeg"); 
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" }); 
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Photo"); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + _path)); 
sendIntent.setType("image/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:")); 

笏的錯誤的代碼?

回答

0

有一個類似的帖子here。他們建議使用:

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