I am using a ProgressDialog
to be shown while my background process goes on, but after background process is completed the ProgressDialog is not dismissed still.
Here is my code
private class async extends AsyncTask<String, Void, Boolean> {
final ProgressDialog progressDialog = new ProgressDialog(getParent());
@Override
protected Boolean doInBackground(String... params) {
GetJson json = new GetJson();
boolean success = false;
JSONObject mJsonObject = json
.readJsonObject("url");
try {
success = mJsonObject.getBoolean("success");
} catch (Exception e) {
}
return success;
}
@Override
protected void onPostExecute(Boolean result) {
if (result) {
if (progressDialog.isShowing())
progressDialog.dismiss();
}
}
}
@SuppressWarnings("static-access")
@Override
protected void onPreExecute() {
progressDialog.show(getParent(), "Working..", "Please wait...");
}
}
result
ever becomes true? You don't handle a possible exception at all which is a bad thing.onPostExecute()
the parameterresult
is definitelytrue
?