【发布时间】:2013-04-10 03:26:11
【问题描述】:
所以,我有此代码来创建电子邮件 Intent,以便我的用户可以发送支持邮件。
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL, new String[]{"username@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "The subject");
i.putExtra(Intent.EXTRA_TEXT, "The body");
startActivity(Intent.createChooser(i, "Send email"));
使用该代码,它会打开一个对话框,我将在其中选择要使用哪个应用程序发送电子邮件。当我按下Back button 时,它会返回到Home screen,并且如果我点击其他地方来关闭对话框。当我选择一个应用程序时,例如 Gmail,它会打开 Gmail(我现在可以发送电子邮件),但是当我按下发送时,它也会返回到 Home screen,如果我按下 Back button。
现在,我的问题是如何返回到以前的Activity 按我按Back button,如果我想取消发送邮件?当我想取消它时,也适用于对话框。
【问题讨论】:
标签: android email android-intent android-activity