On Tuesday, May 20, 2014 11:51:35 PM UTC-4, Jonathan S wrote:
>
> Can you copy and paste code in the *MyRemoteActivity class?*
>>
>
>     It's 700 lines of (mostly proprietary) code, so no I don't think that 
would be practical.    Anyway,* my questions are generic Android questions*; 
they're not specific to the code:   I'm not asking for anyone to debug this 
for me; I'm just trying to understand more so I can debug it myself.

1. * 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?* 
...in other words what does Android mean by "wrong thread"?  If the 
debugger shows it executing in the same thread when it's not crashing as 
when it lands in the catch block with the "wrong thread" then what exactly 
do they mean by "wrong thread"?

*And what does the Eclipse debugger thread nomenclature ( "Thread x[ 
Thread-y]" ) mean?*
The Eclipse debugger seems to refer to a thread 9 and a thread 10.   What 
does the debugger mean when it displays it that way?

*What are some good strategies for analyzing "wrong thread" bugs? *  
Just that -  what tools or strategies are recommended to see what code is 
executing in which threads - how do experienced Android programmers debug 
these kinds of exceptions?

 

> On Tuesday, May 20, 2014 4:17:16 PM UTC-4, plnelson wrote:
>>
>> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
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 android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to