"Hello, I'm trying to do some work in a thread"

For starters you're still in the UI thread, your application is not
multi threaded, try using a real thread:

http://developer.android.com/reference/android/os/AsyncTask.html

This will most likely guide you as to when you can update a progress
dialog.


On Apr 6, 2:45 pm, SD315 <sailer...@gmail.com> wrote:
> Hello, i'm trying to do some work in a thread while showing a progress
> dialog until the work is done in the most simple possible way, so far
> i got this:
>
> // "this" is the current activity
> final ProgressDialog prgDialog = ProgressDialog.show(this, "",
>                 "Working...", true, false);
>
> new Thread() {
>   public void run()
>     {
>     Util.DoSomeWork(); // a static method
>     prgDialog.dismiss();
>     }}.start();
>
> at least it work fine in the emulator, but i'm concerned about it's
> correctness, specifically about calling prgDialog.dismiss(); (note
> that the variable prgDialog is created in the main thread), is this
> correct?
>
> bye

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