Ignoring everything else, you should do the work in an async task.  3
seconds is a *LONG* time.  Seriously, it's a really really long time.  When
you are sitting there interacting with your phone and it sits there frozen
for 3 seconds, that's an eternity.

Once you have that out of the way, it's just a matter of deciding what you
want to do in the UI during the time you don't have your final data to
display to the user.  One approach is to just have a progress indicator
embedded in the UI that is shown while waiting for the data -- see for
example the music picker:

http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=blob;f=src/com/android/music/MusicPicker.java;h=c41746ddf2cbeb80e111d72139b42e8f01329c30;hb=HEAD#l565

On Mon, Nov 1, 2010 at 6:34 PM, Bret Foreman <[email protected]> wrote:

> I'm working on the same issue. My Activity takes some time to
> calculate the graphics that will be displayed, about 3 seconds in some
> complex cases. That's just long enough that the user often hits the
> button again. If an hourglass is not an option, I suppose I can throw
> up some sort of splash, do the main work in an AsyncTask, then put up
> the results. But it's a lot of added complication for a 3 second
> delay.
>
> On Nov 1, 5:21 pm, Frank Weiss <[email protected]> wrote:
> > I don't understand your question. Your new activity should load quickly,
> > what time would there be to display an hourglass?
>
> --
> 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]<android-developers%[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