0
我有一個action_send意圖,允許用戶發送電子郵件,但是當他們完成後,我想將它們返回到與發送電子郵件時不同的活動。 我的意圖代碼如下:android action_send intent如何知道一封電子郵件已發送關閉當前活動?
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();
}
}