Handler anatomy
The target of a Message is an instance of Handler. You can think of the name Handler as being short
for “message handler.” When you create a Message, it will automatically be attached to a Handler. And
when your Message is ready to be processed, Handler will be the object in charge of making it happen.
Handler anatomy
To do any real work with messages, you will need an instance of Handler first. A Handler is not just
a target for processing your Messages. A Handler is your interface for creating and posting Messages,
too. Take a look at Figure 26.4.
Figure 26.4 Looper, Handler, HandlerThread, and Messages
Messages must be posted and consumed on a Looper, because Looper owns the inbox of Message
objects. So Handler always has a reference to its coworker, the Looper.
A Handler is attached to exactly one Looper, and a Message is attached to exactly one target Handler,
called its target. A Looper has a whole queue of Messages. Multiple Messages can reference the same
target Handler (Figure 26.4).