*
The moose likes Android and the fly likes What does ZERO in Handler.sendEmptyMessage(0); mean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "What does ZERO in Handler.sendEmptyMessage(0); mean?" Watch "What does ZERO in Handler.sendEmptyMessage(0); mean?" New topic
Author

What does ZERO in Handler.sendEmptyMessage(0); mean?

Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 507
Why do we pass 0? Can we pass any integer?

From API docs,

public final boolean sendEmptyMessage (int what)
Since: API Level 1

Sends a Message containing only the what value.
Returns

Returns true if the message was successfully placed in to the message queue. Returns false on failure, usually because the looper processing the message queue is exiting.

Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
What happened when you tried? What would you expect to happen based on the description "Sends a Message containing only the 'what' value"?
Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 507
What would you expect to happen based on the description "Sends a Message containing only the 'what' value"?

I am reading 'Android in Action' book, and below is the code excerpt. Though we are passing 0, but we are not utilizing it anywhere (atleast not that I am aware of). and that is how the question arose.



Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 507
Guys, can somebody help me here?
 
 
subject: What does ZERO in Handler.sendEmptyMessage(0); mean?