Difference between Handler.post(Runnable r) and Activity.runOnUiThread(Runnable r) [duplicate]

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)