I am honored if this article has helped you, and sorry if I have wasted your time. I hope to use the simplest plain words to help people like me. If there is any mistake, please do point out, so as not to mislead you, also mislead me. This article from: www.jianshu.com/users/320f9… Thank you for your attention.

First of all: this article will not talk too much, just a brief analysis of the Android message processing on the Internet has been very much introduced, and are very good, not repeated manufacturing wheels. As for me, I also looked at the source code, and then recorded here for later review. Take a look in person, will be many times better than reading other people’s articles, memory will be more profound. Even if you forget, you can recall it very quickly.

Share an article: www.cnblogs.com/codingmywor… Except this article was written in September 2011, which is a little early. I read this article several times last year.


A simple analysis of Message, MessageQueue, Looper and Handler is shown in the following figure:

Yesterday someone asked the question: What happens to new Handler() in child threads?

The following is the answer, because in the child thread, there is no Looper and looper.prepare () must be called manually; This thread can then be upgraded to a Looper thread.

Message, MessageQueue and Looper are the real people doing the work. Handler is just more convenient to manage them. Looper is the core class.

So why didn’t we call looper.prepare () manually on the main thread? Can you use Handler as well?

Look at the picture below, see the answer?