Do Android Message 'what' codes need to be unique in the scope of a Handler or a thread? Do Android Message 'what' codes need to be unique in the scope of a Handler or a thread? multithreading multithreading

Do Android Message 'what' codes need to be unique in the scope of a Handler or a thread?


The messages will be delivered only to the handler you use to send the message, two different handlers will not share any info about the messages sent to a different handler, hence, if you have the same "what" attribute in different messages, it will be passed to the "handleMessage(Message msg)" of the handler that called "sendMessage(yourMessage)", for example:

secondUIThreadHandler.sendMessage(secondMsg);

In the code above it means that the message will be received by the second handler only and it will be able to use the "what" attribute no matter if that attribute is the same for another message other than the current one used in secondUIThreadHandler.

Hope it helps!

Regards!