How can i add image in email body

Posted by Kutbi on Stack Overflow See other posts from Stack Overflow or by Kutbi
Published on 2010-12-28T04:43:40Z Indexed on 2010/12/28 4:54 UTC
Read the original article Hit count: 276

Filed under:
|
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"));*

© Stack Overflow or respective owner

Related posts about android

Related posts about intent