我似乎无法将电子邮件发送到Android中。 可能是一些愚蠢但我找不到的东西:
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain")
.putExtra(android.content.Intent.EXTRA_EMAIL,new String[] { "jb@mail.anykey.co.il" })
.putExtra(android.content.Intent.EXTRA_SUBJECT,"Exception in Yaniv!")
.putExtra(android.content.Intent.EXTRA_TEXT,"test");
ApplicationControllerBase.getMyApplicationContext().startActivity(Intent.createChooser(emailIntent,
"Send mail...").addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
我没有在startActivity命令上收到任何错误或异常。
=======
编辑:
似乎这个问题和这个人有同样的问题:Android: How to start an activity from an UncaughtExceptionHandler set in application
答案 0 :(得分:0)
setType应为plain/text
尝试使用以下代码
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"webmaster@website.com"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "mySubject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "myBodyText");
startActivity(Intent.createChooser(emailIntent, "Send mail..."));