繁体   English   中英

如何在电子邮件正文中添加图像

[英]How can i add image in email body

final Intent i = new Intent(android.content.Intent.ACTION_SEND);
i.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{ txt.getText().toString()});
    i.putExtra(Intent.EXTRA_SUBJECT, "Merry Christmas");        
    i.setType("text/html");

    Spanned html =Html.fromHtml("<html><body>h<b>ell</b>o<img src='http://www.pp.rhul.ac.uk/twiki/pub/TWiki/GnuPlotPlugin/RosenbrockFunctionSample.png'>world</body></html>",
    new ImageGetter() {

     InputStream s;
     public Drawable getDrawable(String url) {

      try {
       s = (InputStream) (new URL(url)).getContent();
      } catch (MalformedURLException e) {

       e.printStackTrace();
      } catch (IOException e) {

     e.printStackTrace();
    }
    Drawable d = Drawable.createFromStream(s, null);
    LogUtil.debug(this, "Got image: " + d.getClass() + ", " + d.getIntrinsicWidth() + "x" + d.getIntrinsicHeight());
    d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
    return d;
    }},null);
    i.putExtra(Intent.EXTRA_TEXT, html);
    startActivity(Intent.createChooser(i, "Send email"));*

看到这个应用程序

此应用程序仅适用于不在Android模拟器中的设备..

http://blogingtutorials.blogspot.com/2010/12/send-email-with-attached-file-in.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM