What is best way to remove ProgressDialog
<p>I have created a progress dialog by </p>

<pre><code>ProgressDialog progressDialog = null; // create instance variable of ProgressDialog
int dialogID = 1;
//to create progress dialog

protected Dialog onCreateDialog(int id) {
progressDialog = new ProgressDialog(context);
progressDialog.setMessage(message);
progressDialog.setIcon(android.R.id.icon);
return progressDialog;
}

// to show progressdialog 
showDialog(dialogID);
</code></pre>

<p>To remove the dialog I am able to use any of the following three approaches</p>

<p><strong>approach-1</strong> </p>

<pre><code>if(progressDialog != null){
progressDialog.dismiss();
}
</code></pre>

<p><strong>approach-2</strong></p>

<pre><code>if(progressDialog != null){
    progressDialog.cancel();
    }
</code></pre>

<p><strong>approach-3</strong></p>

<pre><code>removeDialog(dialogID);
</code></pre>

<p>I found second approach is more effective than first approach. and if I have to use with more than one progressdialog it is easier to use approach-3. But what is the best way to destroy a progressdialog and How?</p>
