How can I dismiss ProgressDialog in AsyncTask
<p>I am using a <code>ProgressDialog</code> to be shown while my background process goes on, but after background process is completed the ProgressDialog is not dismissed still.</p>

<p>Here is my code</p>

<pre><code>private class async extends AsyncTask&lt;String, Void, Boolean&gt; {
    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...");
    }
}
</code></pre>
