Thread safe way of displaying a Toast Message For AsyncTask

suggest change

If you don’t want to extend Application and keep your toast messages thread safe, make sure you show them in the post execute section of your AsyncTasks.

public class MyAsyncTask extends AsyncTask <Void, Void, Void> {

    @Override
    protected Void doInBackground(Void... params) {
        // Do your background work here
    }

    @Override
    protected void onPostExecute(Void aVoid) {
        // Show toast messages here
        Toast.makeText(context, "Ding! Your Toast is ready.",   Toast.LENGTH_SHORT).show();
    }
    
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Toast:
*Thread safe way of displaying a Toast Message For AsyncTask

Table Of Contents
53Toast
169XMPP
230AIDL
242Okio