A view is bound to the thread it is created in.  (Actually not view itself,
but many subclasses have an internal Handler for scheduling work.)  Yes, it
can be annoying in some cases, but that's the way it is.

On Wed, Apr 8, 2009 at 11:49 AM, Mariano Kamp <[email protected]>wrote:

> Hi Dianne,
>
> what I am still wondering about is why I would need a Looper.prepare() to
> create a View object when it is not attached to a Window.
>
> Here is the background: I have a "list activity" and a "show detail
> activity" and an "app". The user jumps frequently between the list activity
> and the show detail activity. In order to speed things up a bit I would like
> to cache the inflated GUI in "app" and call setContentView with this cached
> view in onCreate of "show detail activity". And to make sure that also the
> first call to onCreate on "show detail activity" doesn't have to wait I
> would like to inflate it in a separate thread.
>
>
> On Wed, Apr 8, 2009 at 8:00 PM, Dianne Hackborn <[email protected]>wrote:
>
>> Do it on the main thread.
>>
>> If you want to actually run UI on another thread, read up on Looper and
>> Handler, do all the stuff such as calling Looper.prepare() in your thread,
>> and then redesign your thread logic to be messages based on not do work more
>> than a few seconds and all of the other constraints on a thread that is
>> running UI.
>>
>
>
> >
>


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