gpt4 book ai didi

android - Intent.EXTRA_EMAIL 未填充“收件人”字段

转载 作者:IT老高 更新时间:2023-10-28 13:07:38 26 4
gpt4 key购买 nike

我正在尝试使用 从我的应用程序发送电子邮件,但不会填充电子邮件的收件人字段。如果我添加代码来填写主题或文本,它们就可以正常工作。只有收件人字段不会填充。

我也尝试将类型更改为“text/plain”和“text/html”,但我遇到了同样的问题。有人可以帮忙吗?

public void Email(){

Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("message/rfc822"); //set the email recipient
String recipient = getString(R.string.IntegralEmailAddress);
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL , recipient);
//let the user choose what email client to use
startActivity(Intent.createChooser(emailIntent, "Send mail using...")); }

我尝试使用的电子邮件客户端是 Gmail

最佳答案

我认为您没有将 recipient 作为 array of string

传递

应该是这样的

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[] { "someone@gmail.com" });

关于android - Intent.EXTRA_EMAIL 未填充“收件人”字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9097080/

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