Android Email Verification

I use the following code to send an email to an email address. When I click the submit button, there is a toast message that says “Send ...”, but I don’t have it in the code. It should be the default. My problem is that it says that the message should be sent, but does not say that it was sent. I know that it cannot be checked if it arrived, but there should be an msg saying that it was sent. I hope this shows an error when it is not sent, but users do not know this.

Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("text/plain");
        i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"something@gmail.com"});
        i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
        i.putExtra(Intent.EXTRA_TEXT   , "body of email");
        try {
           startActivity(Intent.createChooser(i, "Send mail..."));
        } catch (android.content.ActivityNotFoundException ex) {
           Toast.makeText(About.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
        }

thank

+3
source share
2 answers

. , - .

:

onActivityResult & Android "

:

Trivial: , android

ICS , 0 resultCode , .

0

:

protected void onActivityResult(int requestCode, int resultCode, Intent data)

{

    if(requestCode==1)
    {
        if(requestCode==1 && resultCode==Activity.RESULT_OK)    
        {
            Toast.makeText(this, "Mail sent.", Toast.LENGTH_SHORT).show();


        }
        else if (requestCode==1 && resultCode==Activity.RESULT_CANCELED)
        {
            Toast.makeText(this, "Mail canceled.", Toast.LENGTH_SHORT).show();


        }
        else 
        {
            Toast.makeText(this, "Plz try again.", Toast.LENGTH_SHORT).show();

        }

    }   
}
0

All Articles