1

I just created an Activity where the user after filling some fields and clicking a button the code that is being executed is :

Intent sendEmail = new Intent(android.content.Intent.ACTION_SEND);

                    /* Fill it with Data */
                    sendEmail.setType("plain/text");
                    sendEmail.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"mail@mail.com"});
                    sendEmail.putExtra(android.content.Intent.EXTRA_SUBJECT, txtName.getText().toString());
                    sendEmail.putExtra(android.content.Intent.EXTRA_TEXT,
                            "name:"+txtName.getText().toString()+'\n'+
                                    "Email ID:"+txtMail.getText().toString()+'\n'+
                                    "Product link:"+'\n'+image);

                     /* Send it off to the Activity-Chooser */
                    startActivity(Intent.createChooser(sendEmail, "Send mail..."));

What I want to do now is , after the user has been prompted to choose an e-mail application to send the e-mail :

  1. If the user denied to send the e-mail by clicking somewhere else on the screen , so the "choose e-mail sender" disappeared , i would like to display him a message pop-up about the process that he should follow instead.

  2. If the user successfully chose e-mail application and finally sent the e-mail , after returning to the previous activity i would like it to finish.

Can anyone help guys?

Thanks in advance.

Kartik Sharma
  • 723
  • 8
  • 19
  • Possible duplicate of [Detect Email Sent or Not in onActivity Result](http://stackoverflow.com/questions/17102578/detect-email-sent-or-not-in-onactivity-result) – Kartik Sharma Jan 12 '17 at 03:35
  • For 1. Possible duplicate of [Get Chosen App from Intent.createChooser](http://stackoverflow.com/questions/24561855/get-chosen-app-from-intent-createchooser#34804275). If you have don't have received a chosen app callback when the user returns then you should show the message popup – friedger Jan 12 '17 at 10:48

0 Answers0