Question

I am getting two errors

android.util.AndroidRuntimeException: { what=53 when=0 arg1=325 } This message is already in use.

java.lang.IllegalStateException: The specified message queue synchronization barrier token has not been posted or has already been removed.

Some searching give me an answer, that problem might be because of one object allocation and two send methods. But I don't do multiple sends.

I assume, that problem can be in following. I use messages for interconnection with network service and GUI. And messages have following structure: int what, int arg, Object Message. So, I use messages in messages. This is caused by feature, that depending on 'what' argument, message in object may be sent to different activities or cached until needed activity not become visible. And inner messages is obtained by Message.obtain() method, which returns messages from own messages pool.

So, must I simultaneously use message, that is allocated by obtain() method or can store it in argument?

P.S. I can't stable reproduce this bug, but receive a lot of bug reports from users.

P.P.S If I cache message, i create local copy of original message, so another obtain method can't override my cached message.

Était-ce utile?

La solution

Problem was solved by reobtaining messages using Message.obtain.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top