Android: Toast on Thread

Asked 1 years ago, Updated 1 years ago, 103 views

How do I get a Toast message from the thread?

android multithreading toast

2022-09-22 16:53

1 Answers

You can invoke the runOnUiThread method of Activity within that thread.

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


2022-09-22 16:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.