3

I have fragment. when click button,it send mail, but i don't know when mail send success, after i show dialog success. my code send :

 //Intent action send
        Intent email = new Intent(Intent.ACTION_SEND);
        email.putExtra(Intent.EXTRA_EMAIL,
                       new String[]{to});
        email.putExtra(Intent.EXTRA_SUBJECT,
                       "bbbbb");
        email.putExtra(Intent.EXTRA_TEXT,
                       "AAAAAAA"));

        //need this to prompts email client only
        email.setType("message/rfc822");
        getActivity().startActivity(Intent.createChooser(email,
                                                         "Send mail..."));

i want show dialog when mail send success. Please help me. thanks

QuestionAndroid
  • 881
  • 1
  • 8
  • 25

1 Answers1

0

It seems like there is no good solution for this.

The 'normal' way would be to use startActivityForResult() as you send your intent, but Intent.ACTION_SEND gives no output (documentation) so this doesn't work either. See this question.

The only way to do it for sure would be to make your own activity to send the email, and return a result from that.

Community
  • 1
  • 1
gkee
  • 771
  • 1
  • 7
  • 11