This really won't gain you anything.  The time between onAttach() and
onActivityCreated() is the time your activity spends in onCreate().

On a dual core CPU, maybe you will be able to get a little more work done.
 Maybe.  On a single core, there is only one CPU available, there are no
pauses going on during this, so the CPU is already in full use.

Another point -- if you are doing work on another thread, you will probably
be sending a message back to the main thread with its result.  If you think
onActivityCreated() is late, the time until the main thread actuallly goes
back to process the next message in the queue is way way way late, after
everyone has gone through onResume().

On Tue, Feb 15, 2011 at 4:06 PM, davemac <[email protected]> wrote:

> There are quite a few callbacks associated with a fragment. The sample
> programs I've seen so far use simple, local string and resource data
> in onActivityCreated(), which seems late to me. Would there be any
> problem with spinning off a thread, or AsyncTask, or equivalent, as
> early as onAttach(), or even in onInflate() to go get data from disk
> or over the network? Then by the time onActivityCreated() is called,
> the data might be ready, and if not, I could just leave placeholders
> in the UI until the data comes back. Any advice from the Android team
> please? Thanks.
>
> P.S. Sorry if this looks like a re-post. It is, but I can't see my
> previous post at all. It just disappeared.
>
> --
> 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
>



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