Skip to content Skip to sidebar Skip to footer

Android Toast Message From A Separate Thread Class

I am confused about how to use Toast to print out messages. I need to use it to print out messages that come from the thread's while loop. My thread which renders graphics are on a

Solution 1:

You can use runOnUiThread:

myActivity.runOnUiThread(new Runnable() {

 public void run() {
    Toast.makeText(context, text, duration).show();
 }

});

Post a Comment for "Android Toast Message From A Separate Thread Class"