The way I do this on Android is display a dialog on the main thread (which
essentially locks out the UI to the user while not blocking the actual
thread) and then do all the heavy work in another thread.

As Nick mentioned, AsyncTask is a great way to do this...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, May 11, 2011 at 7:23 PM, Nicholas Johnson
<metthejohn...@gmail.com>wrote:

> If fact, I do want the UI to be locked while
>> the proccess is working
>>
>
> Are you sure you want the main thread blocked? This could cause the
> "Application Not Responding" error to pop up during your lengthy process.
> And users tend to get very confused when their phones become unresponsive.
>
> On other platforms,
>> there is some kind of DoEvents() or DoPendingEvents() functions which
>> allow UI threads to proccess pending messages before continuing with
>> the execution.
>>
>> There is some way of doing this in Android?
>
>
> Not that I'm aware of. But you should really consider putting your "lengthy
> process" in its own thread. An AsyncTask seems like it'd work well for you
> here. You can even update your text view in the onPreExecute method, and
> then notify the user of completion in the onPostExecute method.
>
> Nick
>
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to