gpt4 book ai didi

Android - 尝试发送电子邮件时出现错误 "no application can perform this action"?

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:58:28 25 4
gpt4 key购买 nike

我正在制作一个应用程序,我将在其中向我的客户提供反馈功能。为了实现这一点,我创建了一个小对话框,用户可以在其中输入反馈并将其发送到我的邮件 ID。我尝试了一些在互联网上找到的代码 fragment ,但每当我尝试从模拟器或实际设备发送电子邮件时,我都会收到错误消息“没有应用程序可以执行此操作”。

这是我的代码:-

public void emailDialog()
{
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
alertDialog.setTitle("Feedback");
alertDialog.setMessage("Please tell us that what you feel about our product. If you are facing any problem or found any bug then please report to us. Your review is important to us. Thanks!!");
final EditText input = new EditText(this);
input.setLines(8);
alertDialog.setView(input);
alertDialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String value = input.getText().toString();
String address = "varundroid@gmail.com";
String subject = "FeedBack";
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, address);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, value);
CompleteTaskManager.this.startActivity(Intent.createChooser(emailIntent, "Send Email.."));
}
});
alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Canceled.
}
});
alertDialog.show();
}

请帮助。

最佳答案

我认为您需要设置 Intent 对象的类型。你能试试下面的方法吗

emailIntent.setType("message/rfc822");

emailIntent.setType("text/plain");

关于Android - 尝试发送电子邮件时出现错误 "no application can perform this action"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5779077/

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