Handler. sendmessage (new message). This method means that handler needs to send a new object when sending a message. That is, after updating the date when sending a message, you need to reconstruct the message object instead of using the constructed object. Otherwise, an error is reported:
06-27 09:25:39. 073: Error/androidruntime (1170): Android. util. androidruntimeexception: {What = 0 when = 3496212 arg1 = 10 OBJ = android. graphics. drawable. animatedrotatedrawable @ 44f4b1a8} this message is already in use.
For example, the following code:
[Java: collapse: showcolumns]+
Expand sourceview
Plaincopy
··· · 50 ······· · 90 ····· · 140 · 150
It seems correct, but an error is reported during running.
The correct code should be:
[Java: collapse: showcolumns]+
Expand sourceview
Plaincopy
··· · 50 ······· · 90 ····· · 140 · 150
If you understand the message queue mechanism of handler, you will understand why "this message is already in use. "error, because each time the handler sendmessage () sends a message to a message-to-queue, it must be a new message object.