如何启动Android的电子邮件应用程序(com.android.email)?
答案 0 :(得分:2)
你可以从意图开始
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "your@email.com" });
intent.putExtra(Intent.EXTRA_SUBJECT, "YOUR SUBJECT");
intent.putExtra(Intent.EXTRA_TEXT, "YOUR MAIL BODY");
startActivity(Intent.createChooser(intent, ""));
答案 1 :(得分:2)
由于您需要启动一个包,这应该是您正在寻找的解决方案:
Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.email");
startActivity(intent);
答案 2 :(得分:1)
我认为这对您打开电子邮件应用程序非常有用。
Intent mailClient = new Intent(Intent.ACTION_VIEW);
mailClient.setClassName("com.google.android.gm", "com.google.android.gm.ConversationListActivity");
mailClient.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(mailClient);
答案 3 :(得分:0)
使用以下意图在Android设备上启动电子邮件应用程序:
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
String[] recipients = new String[]{"a@email.com", "",};
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, recipients);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "This is email's message");
emailIntent.setType("text/plain");
startActivity(Intent.createChooser(emailIntent, "Send mail..."));