I have an AsyncTask that shows a progressDialog whilst working (it calls runOnUiThread from within doInBackground to show the progress dialog).
<
javano... I tested your scenario using standard techniques, asyncTask and ProgressDialog. In my test, when the progressDialog is showing and i hit back, the progressdialog is dismissed and the background thread continues to run. I do not know why you need to call runOnUiThread.
SO:
show the progressDialog in onPreExecute place the long running task in doInBackground dismiss the progressDialog in onPostExecute pass the input parameters to your long running task as in:
new MyAsynch().execute(password,inString);
cancel() the asynchTask and progressDialog in onPause
protected void onPause() {
super.onPause();
if (asynch != null) {asynch.cancel(true);}
if (progress != null){progress.cancel();}
}
JAL
I have some code here.