Saturday, August 27, 2011

Re: [android-developers] delay

On Sat, Aug 27, 2011 at 2:53 PM, Appaholics <raghavsood@appaholics.in> wrote:
> What do you mean by making it more user friendly?
>
> On Sat, Aug 27, 2011 at 11:36 PM, bob <bob@coolgroups.com> wrote:
>>
>> Right now, I have code that has to download data from the web after
>> you click a button.  So, there's a delay.  Anyone know how to make
>> this more user-friendly?
>>

I'd assume that he means that he's sleeping in the main thread and
it's causing ANRs, or just sluggish performance. If you want to
download data, do it in a separate thread, look at AsyncTask. If you
look at AsyncTask, you should find what you need, you can google
around for examples. You can also use a service to do your
downloading for you, if you want to coordinate between different
pieces of the app. (Note however, that you still have to use a
separate thread, as a service in and of itself is not a separate
thread.)

Kris

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment