我有一段代码用于发送电子邮件意图
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL,
new String[] { to });
i.putExtra(Intent.EXTRA_SUBJECT, subject);
i.putExtra(Intent.EXTRA_TEXT, msg);
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(Start.this,
"There are no email clients installed.",
Toast.LENGTH_SHORT).show();
}
但是,当这个意图被触发时,我在列表中看到了很多条目,如短信应用程序、Gmail 应用程序、Facebook 应用程序等。
我该如何进行筛选,并仅启用 Gmail 应用程序(或仅启用电子邮件应用程序)?
ACTION_SENDTO
时,意图选择器会显示“未安装应用程序以执行此意图”。我使用的是Android 4.1.2,已经安装了邮件应用程序... - ffleandro