gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:30:27 27 4
gpt4 key购买 nike

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

关于android - 如何在电子邮件正文中添加图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4543700/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com