最终意图I =新的意图(android.content.Intent.ACTION_SEND);
i.putExtra(android.content.Intent.EXTRA_EMAIL,新的String [] {。txt.getText()的toString()});
i.putExtra(Intent.EXTRA_SUBJECT,圣诞快乐);
i.setType(text / html的);
跨区HTML = Html.fromHtml(&LT; HTML&GT;&LT;身体GT; H&LT; B&GT; ELL&LT; / B&GT; O&LT; IMG src='http://www.pp.rhul.ac.uk/twiki/pub/TWiki/GnuPlotPlugin/RosenbrockFunctionSample.png'>world</body></html>",
新ImageGetter(){
InputStream的S;
公众可绘制getDrawable(字符串URL){
尝试 {
S =(的InputStream)(新的URL(网址))的getContent();
}赶上(MalformedURLException异常E){
e.printStackTrace();
}赶上(IOException异常E){
e.printStackTrace();
}
绘制对象D = Drawable.createFromStream(S,NULL);
LogUtil.debug(这一点,得到的图像:+ d.getClass()+,+ d.getIntrinsicWidth()+X+ d.getIntrinsicHeight());
d.setBounds(0,0,d.getIntrinsicWidth(),d.getIntrinsicHeight());
返回D组;
}},空值);
i.putExtra(Intent.EXTRA_TEXT,HTML);
startActivity(Intent.createChooser(我,发送电子邮件)); *
解决方案
看到这个应用程序
该应用程序仅在设备工作不Android模拟器..
的http://blogingtutorials.blogspot.com/2010/12/send-email-with-attached-file-in.html
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"));*
解决方案
see this application
This application only work in device not in android emulator..
http://blogingtutorials.blogspot.com/2010/12/send-email-with-attached-file-in.html
上一篇:之间使用WCF 2 WinForm应用程序通信?应用程序、通信、WCF、WinForm
下一篇:.NET 3.5 Smtpclient - 失败时发送电子邮件 - 只是每次重启后的工作重启、发送电子邮件、工作、NET