Well, if you use findViewById() in a thread, that's plain out wrong.
The function you posted seems wrong in that it first makes a UI call
in that thread context.
Then it attempts to use a queue to post a runnable to so that
setText() runs in the UI thread.
It's redundant if it's already in the UI thread, and broken if it's in
another thread.

On Fri, Aug 19, 2011 at 10:45 AM, cellurl <[email protected]> wrote:
> I keep getting told that my code violates the UI and lifecycle rules
> and I have no idea how to find/fix it.
>
> I first read this:
> http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html
>
> Then, I figured I needed to replace things like this:
> (TextView)findViewById(R.id.definition).setText("Hello");
>
> to now read:
>
> TextView t=  (TextView)findViewById(R.id.definition);
> t.post(new Runnable() {
>     public void run() {
>          t.setText("Hello");
>     }
> });
>
> But I still get told that I am in violation.
>
> Q: Are there ways I can flush out these bugs? Are there tools people
> use, or ways to scrutinize the log? or must I just push-buttons real
> fast on a real device?
>
> Any help appreciated!
> -cellurl
>
>
> --
> 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



-- 
~ Jeremiah:9:23-24
Android 2D MMORPG: http://solrpg.com/, http://www.youtube.com/user/revoltingx

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

Reply via email to