Looper.getMainLooper()
Runnable task = getTask();
new Handler(Looper.getMainLooper()).post(task);
Activity#runOnUiThread()
Runnable task = getTask();
runOnUiThread(task);
public final void runOnUiThread(Runnable action) {
if (Thread.currentThread() != mUiThread) {
mHandler.post(action);
} else { //Execute directly for UI thread
action.run();
}
}
Recommended Posts