No time-consuming operations are performed in the main thread, and the child thread does not update the UI
Therefore, Android provides Handler to solve this problem
SendMessage in the child thread notifies the main thread to update the UI
**the whole process:
Create a new Handler , send messages through sendMessage or post, Handler calls sendMessageAtTime to deliver the Message to the MessageQueue
The MessageQueue.enqueueMessage method puts the Message into the queue in the form of a linked list
The loop method of Looper calls MessageQueue.next() to take out the message, and calls the dispatchMessage of Handler to process the message
In dispatchMessage , it is judged that msg.callback and mCallback, that is, the post method or the constructor passed in is not empty, then execute their callback, and if they are empty, execute our most commonly rewritten handleMessage .
runOnUiThread looks very simple, in fact, the principle is the same as above