I have a multi-threaded Android app. One thread wakes up periodically on a 
timer and exchanges information over WiFi with a remote device and the 
other one is the main thread that handles all the usual View stuff.

Lately I've been getting a "Called from Wrong Thread Exception" in a catch 
block in the remote handler thread.

If I set a breakpoint in the remote handler code, when it's NOT crashing, 
the stack trace in the Eclipse debugger says

*Thread[ <9> Thread-10] (Suspended breakpoint at line 600 in 
MyRemoteActivity)*

But if I set a breakpoint in my catch-block when it crashes it names the 
same threads, i.e.,

*Thread[ <9> Thread-10] (Suspended breakpoint at line 605 in 
MyRemoteActivity)*

(... different line number because it's the catch-block which is a few 
lines down.)

My question: If it's the wrong thread then why does the stack trace show 
the same thread in the cases where it crashes and where it doesn't? And 
what does the Eclipse debugger thread nomenclature ( "Thread x[ Thread-y]" 
) mean? What are some good strategies for analyzing "wrong thread" bugs?   
    
Thanks in advance!


-- 
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/d/optout.

Reply via email to