Asynctask Vs Activity.runonuithread() Vs Handler.post()
I'm studying the code of a large app. There are 3 asynchrony patterns used in the UI, all of them seem equivalent: Pattern 1, AsyncTask new AsyncTask() { pr
Solution 1:
They are all really a Handler either visibly or internally.
AsyncTask#finish() that calls onPostExecute() is called from a Handler message loop.
runOnUiThread() posts the Runnable to a Handler if the current thread is not the UI thread. If it is the UI thread, the runnable is executed synchronously - this is not always desirable.
Directly using a Handler gives you low level control and only that.
What to use depends on your specific requirements.
Post a Comment for "Asynctask Vs Activity.runonuithread() Vs Handler.post()"