我正在创建一个应用程序,在该应用程序中,在查看某人的个人资料时,我希望在点击浮动操作栏后让用户收到电子邮件
我可以打开Gmail,但我没有发送电子邮件值,尽管已经发送了它的值
代码:
fabtoemail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
String aEmail = email;
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmail);
emailIntent.setType("plain/text");
startActivity(Intent.createChooser(emailIntent, "Select Application"));
}
});
答案 0 :(得分:0)
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Body");
答案 1 :(得分:0)
试试这个
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto","example@example.com", null));
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "your subject here");
emailIntent.putExtra(Intent.EXTRA_TEXT, "if you want append some text");
startActivity(Intent.createChooser(emailIntent, "Send email..."));