gpt4 book ai didi

java - 在电子邮件android的邮件正文中发送图像

转载 作者:行者123 更新时间:2023-11-29 20:27:38 25 4
gpt4 key购买 nike

我的 Activity 有一个 ImageView 、带有用户输入的电子邮件地址的编辑文本和一个发送按钮。在发送按钮 Activity 中,我已准备好电子邮件、主题和收件人姓名,但我还想添加 ImageView 中包含的图像。

    Intent intent = new Intent(Intent.ACTION_SEND);
intent.setData(Uri.parse("mailto:"));
intent.setType("image/jpeg");
intent.putExtra(Intent.EXTRA_EMAIL, receivers);
intent.putExtra(Intent.EXTRA_SUBJECT, "My subject");
intent.putExtra(Intent.EXTRA_TEXT, "hello wats up");
intent.putExtra(Intent.EXTRA_STREAM, image i want to send);
startActivity(intent);

很明显,最后一行 putExtra 会给我错误,说明他们想要字符串,但我传递的是 imageview。请指导我如何将我的 ImageView 包含在此电子邮件正文中。 (不是作为附件,而是在带有消息文本的消息正文中)。

非常感谢您。

最佳答案

您必须将 fileUri 作为第二个参数传递。像这样。

intent.putExtra(Intent.EXTRA_STREAM, fileUri);

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

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