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, or 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:


a user-defined int that describes the message


a user-specified object to be sent with the message


the Handler that will handle the message

The target of a Message is an instance of Handler. You can think of the name ...

Get Android Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.