我想向特定的电子邮件 ID 发送一些消息。我设置了地址并尝试发送消息。它在 Gmail 应用程序中运行良好。但它在邮件应用程序中无法正常工作,尤其是在 Nexus 7(HTC one V 也是)中,这是什么原因?
源代码
Intent emailIntent = new Intent(android.content.Intent.ACTION_SENDTO);
emailIntent.setType("text/html");
emailIntent.setData(Uri.parse("mailto:naresh.repalle@shoregrp.com"));
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Price Check Guru Feedback");
startActivity(Intent.createChooser(emailIntent, "Email:"));
更新代码
意图 emailIntent = new Intent(android.content.Intent.ACTION_SENDTO); emailIntent.setType("text/html");
//set the To address and Subject
try
{
String strSubject = URLEncoder.encode("Price Check Guru Feedback","UTF-8");
//testing
emailIntent.setData(Uri.parse("mailto:naresh.repalle@shoregrp.com"+ "?subject=" + strSubject));
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
startActivity(Intent.createChooser(emailIntent, "Email:"));