调用方法顺序图:
runOnUiThread()-----》post(Runnable r)----》sendMessageDelayed(Message msg,longdelayMillis)------》endMessageAtTime(Message msg,longuptimeMillis)--》nqueueMessage(MessageQueue queue, Message msg,longuptimeMillis)
最后核心代码在:
Handler的dispatchMessage方法:
public void dispatchMessage(Message msg) {
if(msg.callback !=null) {
handleCallback(msg);
}else{
if(mCallback!=null) {
if(mCallback.handleMessage(msg)) {
return;
}
}
handleMessage(msg);
}
}