Skip to content Skip to sidebar Skip to footer

How To Move Again Mainactivity After Sending The Mail?

I am developing one app, in which I am sending the email with the help of intent. I am successfully sending the mail from MainActivity, but problem is that, as I am clicking on sen

Solution 1:

You can remove finish() Or using startActivityForResult

Solution 2:

Instead of startActivity(Intent.createChooser(emailIntent, "Send mail..."));

You can use

startActivityForResult(Intent.createChooser(emailIntent, 1));

Your activity receives it in the onActivityResult() callback.

@OverrideprotectedvoidonActivityResult(int requestCode, int resultCode, Intent data) {
    // Check which request we're responding toif (requestCode == PICK_CONTACT_REQUEST) {
        // Make sure the request was successfulif (resultCode == RESULT_OK) {
            // The user picked a contact.// The Intent's data Uri identifies which contact was selected.// Do something with the contact here (bigger example below)
        }
    }
}

Post a Comment for "How To Move Again Mainactivity After Sending The Mail?"