Handler loses message after wait() and notify()

by fugu2.0 » Fri, 23 Apr 2010 08:02:06 GMT

Sponsored Links
 Hey Guys!

I have a problem handling messages in a Thread. My run-method looks
like this

public void run() {
   parserHandler = new Handler {
      public void handleMessage(Message msg) {
         Log.i("","id from message: "+msg.getData.getString("id"));
         // further message handling

I have several Activities sending messages to this thread, like this:

Message parserMessage = new Message();
Bundle data = new Bundle();
data.putString("id", realId);
data.putString("callingClass", "CategoryList");

parserHandler = parser.getParserHandler();

synchronized (parserHandler) {
    Log.i("","message ID:  " +


The problem is that the run-method logs "id from message: null" though
"message ID" has a value in the Log-statement. Why does the message
"lose" it's data when being send to the thread? Has it something to do
with the notify? Thanks for your help


Other Threads

1. StackOverflow in Main/UI Thread

Hi All,
I'm running into a StackOverflowException in
ViewRoot.performTraversals. After looking around for a while I've
concluded that my view hierarchy is probably too deep. My questions
are as follows:

1. Why would this only occur on the HTC Thunderbolt and Samsung Nexus
S? Other older devices running eclair/froyo/gingerbread do not have
this problem. My only theory is that the default stack size that these
two devices allocate for the main thread is unusually small.

2. Is there any way I can profile my stack usage such that I can tell
what would be the most useful to remove? The Hierarchy Viewer is cool
and all, but it does nothing for me in terms of interpreting memory

3. Is there any way I can offload some of the layout processing that
is done in ViewRoot to another thread? I know that the constructor for
thread takes a max stack size...perhaps I can the layout or something
to some other, new thread.

Thanks in advance,


2. MOTODEV App Summit Buenos Aires

FYI...  hispanos and comunity



3. DeviceMonitor]Failed to start monitoring <Device-number>

4. Wanted: Convmv for Android, a useful tool

5. [OpenGL ES] Using transparent png textures won't work

6. Has Android support of parsing WBXML (SyncML, OMA standarts)??

7. How to change Notification Duration on HoneyComb?