我有一个 action_send 意图,允许用户发送电子邮件,但是当他们完成后,我想让他们返回到与发送电子邮件时不同的活动。我的意图代码如下:
public void sendEmail(){
String path = Environment.getExternalStorageDirectory().toString() + "/" + "screenshots/";
String target_filename = "CheeseNav.jpg";
File externalFile = new File(path, target_filename);
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL, new String[]{""});
i.putExtra(Intent.EXTRA_SUBJECT, "Email sent from android app");
i.putExtra(Intent.EXTRA_TEXT, "");
Uri sendUri = Uri.fromFile(externalFile);
i.putExtra(Intent.EXTRA_STREAM, sendUri);
try{
startActivity(Intent.createChooser(i, "Send mail..."));
} catch(android.content.ActivityNotFoundException ex){
Toast.makeText(ScreenViewer.this, "There are no email clients installed.",
Toast.LENGTH_SHORT).show();
}
}