runOnUiThread(new Runnable() {
@Override
public void run() {
// Stuff that updates the UI
}
});
Asked
Active
Viewed 63 times
-1

ADM
- 20,406
- 11
- 52
- 83

Ahmad Tariq
- 1
- 1
- 5
1 Answers
1
This method as described in documentations,
Runs the specified action on the UI thread. If the current thread is the UI thread, then the action is executed immediately. If the current thread is not the UI thread, the action is posted to the event queue of the UI thread.
In summary, it can be used when you want to perform an action from background thread on UI thread. For example updating a progress bar from background thread which can not be done from that background thread. You pass a runnable to it and it execute that runnable inside UI thread.
You can read here for more information.

Amin Mousavi
- 1,220
- 10
- 21