Is there a difference between
new Handler.post(Runnable r);
and
activity.runOnUiThread(Runnable r)
From the official Handler docs
Handler
There are two main uses for a Handler:
(1) To schedule messages and runnables to be executed as some point in the future.
(2) To enqueue an action to be performed on a different thread than your own.
In short, Handler is used to manage different Runnables.
runOnUiThread
It is used to execute the non-UI operation on the UI Thread, example if you want to update the screen from AsyncTask's doInBackground() you have to write the part of code that update's the UI inside the runOnUiThread(). But again that will block the UI.