Saturday, June 29, 2019

multithreading - Android: Toast in a thread




How can I display Toast messages from a thread?


Answer



You can do it by calling an Activity's runOnUiThread method from your thread:



activity.runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(activity, "Hello", Toast.LENGTH_SHORT).show();
}
});


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...