That code does not remove the 0th Message.
It removes all messages that have a "what" value of 0. The "what" is apparently an id associated with the messages (not necessarily unique) : <https://lh4.googleusercontent.com/-NFUf7VOHEOU/UWgawLxDSKI/AAAAAAAAAW0/8AjbjmNtl_Y/s1600/what.png> Thanks. On Thursday, April 11, 2013 8:20:06 PM UTC-5, NoraBora wrote: > > Sometimes you use a handler as a member variable and use it for > sendMessages(), removeMessage(), post(). > I just found out something. > > Say you call these > handler.sendMesssage(0) // 1 > handler.post(new Runnable()) // 2 > handler.post(new Runnable()) // 3 > > and call this > handler.removeMessage(0) > > then this will remove 2, 3 as well as 1 > because removeMessage/hasMessage doesn't check runnable and posted > message's what value is 0 by default. > > Some people could think this as a bug but it's too late to change such a > basic api so > I think documentation should mention this. > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

