我有一个问题,我希望在我的应用程序中拥有一个特定的电子邮件接收器,每当用户按下电子邮件按钮时,它就会向他/她显示一个固定的接收器。我怎样才能做到这一点?
public void google(View v){
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "");
Intent shareIntent = Intent.createChooser(emailIntent,"");
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(shareIntent);
}
最佳答案
使用此代码希望它会有所帮助
Intent Email = new Intent(Intent.ACTION_SEND);
String[] recipents ={"your_recepient_email"};
Email.putExtra(Intent.EXTRA_EMAIL,recipents);
Email.setType("text/html")
Email.setPackage("com.google.android.gm");
startActivity(Intent.createChooser(Email, "Send mail"));
如果您想要主题和内容,请使用类似于添加主题行的代码。
关于java - 调试Android Intent 问题(无特定接收者),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59786157/