new PersonnelLookUpTask();// start task..choose where u want to start it..oncreate or button click..ur choice.
Input|Progress(u can ignore this parameter)|Output private class YourLookUpTask extends AsyncTask<String,Void ,ArrayList<PersonnelObject>>{ @Override protected ArrayList<PersonnelObject> doInBackground(String... params) { //put the stuff ur run executes here } @Override protected void onCancelled() { // TODO Auto-generated method stub dialog.dismiss(); super.onCancelled(); } @Override protected void onPostExecute(ArrayList<PersonnelObject> result) { Progressdialog.dismiss(); } @Override protected void onPreExecute() { super.onPreExecute(); //ProgessDialog.show(); } } hope htis helps On 6 April 2011 05:45, 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 -- 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