我正在尝试创建应用内反馈电子邮件。我有以下功能:
public void sendEmail(){
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT , "body of email");
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(getActivity(), "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
}
但是,当我调用此方法时,会启动一个新活动,我会得到StackoverflowError之类的:
09-16 13:44:31.923: E/AndroidRuntime(1079): FATAL EXCEPTION: main
09-16 13:44:31.923: E/AndroidRuntime(1079): Process: com.example.demo, PID: 1079
09-16 13:44:31.923: E/AndroidRuntime(1079): java.lang.StackOverflowError
09-16 13:44:31.923: E/AndroidRuntime(1079): at com.example.demo.database.MySQLiteHelper.close(MySQLiteHelper.java:59)
09-16 13:44:31.923: E/AndroidRuntime(1079): at com.example.demo.database.MySQLiteHelper.close(MySQLiteHelper.java:59)
09-16 13:44:31.923: E/AndroidRuntime(1079): at com.example.demo.database.MySQLiteHelper.close(MySQLiteHelper.java:59)
09-16 13:44:31.923: E/AndroidRuntime(1079): at com.example.demo.database.MySQLiteHelper.close(MySQLiteHelper.java:59)
你们有什么建议吗?提前谢谢。