How do you get a View from the current window (Activity?) using this
method in a worker thread (not GUI)? And, even if you did, there is
still a window (of execution) between the time you get the view and
the time the runnable runs. The Activity may have changed in that
window of execution.

On Feb 11, 12:49 pm, Dianne Hackborn <[email protected]> wrote:
> On Tue, Feb 9, 2010 at 9:39 AM, Frank Weiss <[email protected]> wrote:
> > The conundrum on Android is that user code can't block in a UI thread and
> > non-UI threads can't manipulate the UI.
>
> It is almost trivial to, from another thread, schedule a Runnable on the
> window's thread to do work on it:
>
> void myThreadDoingStuff() {
>     // ...
>     final int viewVisibility = somethingWeComputed;
>     //
>     final View view = getSomeViewInWindow();
>     view.getHandler().post(new Runnable() {
>         public void run() {
>             view.setVisibility(viewVisibility);
>         }
>     });
>     // ...
>
> }
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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