Intent intent = new Intent(Intent.ACTION_SENDTO); // it's not ACTION_SEND
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject of email");
intent.putExtra(Intent.EXTRA_TEXT, "Body of email");
intent.setData(Uri.parse("mailto:default@recipient.com")); // or just "mailto:" for blank
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // this will make such that when user returns to your app, your app is displayed, instead of the email app.
startActivity(intent);
此方法调用内置电子邮件,但我想将用户发送的电子邮件地址和文本输入邮件信息是否可以复制任何一个可以给我解决方案
答案 0 :(得分:0)
我使用此代码仅选择电子邮件应用程序并推送主题,文本和接收者:
Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
Uri.fromParts("mailto","your.email@example.com", null));
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Body of email");
startActivity(Intent.createChooser(emailIntent, "Send email..."));
如果您不想要正文/主题,您可以将该行留出。