Hi,
I am doing some AsyncTask thing and seems to work ok and after that I
open another intent to display a listview.
The thing is, if the user press the back key, it return to the caller
intent showing the progress dialog and seems to be hanging there until
it crash. What did I do wrong? I already do a dialog.dismiss()
onPostExecute().
Please help me out.
Many thanks,
CJ
private class LongOperation extends AsyncTask<String, Void,
String> {
ProgressDialog dialog;
@Override
protected String doInBackground(String... params) {
// download something from the net and processing it.
// work perfectly
return null;
}
@Override
protected void onPostExecute(String result) {
// execution of result of Long time consuming operation
// some processing from the information taken from the
internet (doInBackground)
if (dialog.isShowing()) {
dialog.dismiss();
}
}
/* (non-Javadoc)
* @see android.os.AsyncTask#onPreExecute()
*/
@Override
protected void onPreExecute() {
// Things to be done before execution of long running operation.
For example showing ProgessDialog
dialog = ProgressDialog.show(Main.this, "",
"Receiving data", true);
}
@Override
protected void onProgressUpdate(Void... values) {
// Things to be done while execution of long running
operation is in progress. For example updating ProgessDialog
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en