Android Programming: The Big Nerd Ranch Guide, 2nd Edition
by Bill Phillips, Chris Stewart, Brian Hardy, Kristin Marsicano
Messages and Message Handlers
Before you create a message, you need to understand what a Message is and the relationship it has with its Handler (often called its message handler).
Message anatomy
Let’s start by looking closely at messages. The messages that a Flash might put in an inbox (its own inbox or that of another Flash) are not supportive notes, like “You run very fast, Flash.” They are tasks that need to be handled.
A message is an instance of Message and contains several fields. Three are relevant to your implementation:
|
what |
a user-defined int that describes the message |
|
obj |
a user-specified object to be sent with the message |
|
target |
the Handler that will handle the message |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access