Android: Assigning string value to activity string variable from AsyncTask’s onPostExecute method not working

I created a REST API which appears to work fine (I tested the GET request of interest using Postman).

I am working to make an identical request from an Android application using an AsyncTask. The hope is to assign a string value generated by the AsyncTask to a string variable in the Android activity.

I have used a Toast to view the string output of the doInBackground method, which is passed to the onPostExecute method of the AsyncTask, to make sure that the call to the API is working and it works fine.

The problem comes when I assign the string output of the AsyncTask to the string variable defined in the Activity class. After executing the AsyncTask I am using a Toast to view the value of the string variable and it is reflecting the assignment performed in the onPostExecute method.

I will now share the code that I am using in the hope that you can help me to find where I might be going wrong. After the button is clicked, I intend for the validate AsyncTask to execute and assign a value to emailValid.

In view of the code below, my question in the most direct way I can put it: “Why is Toast 1 displaying while Toast 2 doesn’t?”

Thank you in advance for your assistance.

public class MyActivity extends AppCompatActivity implements View.OnClickListener
{
    EditText email_et;
    Button join_b;

    String emailValid;

    @Override
    protected void onCreate(Bundle savedInstance)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_join);
        emailValid = "No";
        join_b = (Button) findViewById(R.id.aj_join_b);
        join_b.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) 
    {
        email_et = (EditText) findViewById(R.id.et_aj_email_address);
        new JoinActivity.validate().execute(email_et.getText().toString());
        // Toast 1 here:
        Toast.makeText(getApplicationContext(), emailValid, 
            Toast.LENGTH_LONG).show();
    }

    private class validate extends AsyncTask<String, Void, String> 
    {
        @Override
        protected String doInBackground(String... params) 
        {
            // ... GET request produces string with either yes or no i.e. outcome
            return outcome;
        }
        @Override
        protected void onPostExecute (String s) 
        {
            // Toast 2 here:
            Toast.makeText(getApplicationContext(), s, Toast.LENGTH_LONG).show();
            emailValid = s;
            super.onPostExecute(s);
        }
    }
}