2014-05-24 0:05 GMT+04:00 plnelson <pna...@gmail.com>:

>
>
> On Wednesday, May 21, 2014 12:23:32 PM UTC-4, Kostya Vasilyev wrote:
>>
>>
>>
>> Is there more to the message? I grepped the "base" framework, and came up
>> with these:
>>
>
> The entire message is "CalledFromWrongThreadException: Only the original
> thread that created a view hierarchy can touch its views"
>
> And it's widely discussed on places like Stack Overflow but the focus of
> the dicscussions is always on fixing the bug,
>

Fixing the bug should ultimately be your goal, no?


> whereas I'm posting this to the Google group instead of Stack Overflo0w
> because I want to *understand* what it actually *means*.   What do they
> mean by "the wrong thread"?
>

The "view hierarchy" should only be touched from the UI thread that's
created for you by Android (labeled "main" thread in Eclipse).

Now, some view methods may have checks for this, and some may not (in fact,
the vast majority does not).


> If the same thread (based on the debugger and trace) is accessing it when
> it generates the exception and when it doesn't, how does that thread become
> the "wrong" thread?   Where does Google document its exceptions?
>

http://developer.android.com/guide/components/processes-and-threads.html

Additionally, the Andoid UI toolkit is *not* thread-safe. So, you must not
manipulate your UI from a worker thread—you must do all manipulation to
your user interface from the UI thread. Thus, there are simply two rules to
Android's single thread model:

   1. Do not block the UI thread
   2. Do not access the Android UI toolkit from outside the UI 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?
>>>
>>
>> They're just thread ids (the "x") and auto-generated thread names.
>>
>
> Yes, I know, but why are there *two* of them on one line?  That's my
> question.  Normally I see one TID per line, so what is Eclipse telling us
> when it uses *"Thread x[ Thread-y]" syntax?*
>

I really don't know. Looks like the name is assigned based on thread id,
but does not use the thread id directly -- maybe some little piece of code
with own counter, etc.

But if this discussion is to be focused on "only the original thread can
touch the view hierarchy" -- you should not be touching views from any
thread other than the main UI thread, and that one is clearly labeled in
Eclipse as "Thread [<1> main]".

Hope I didn't make it completely nonsensical.

-- K

-- 
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