how do I dismiss my progress dialog after the needed function in alert dialog is applied?
<p>I have a link in my fragment, which shows " click to open dialog" ,upon clicking it, an alert dialog pops up, showing " do you want to change the view? " with yes and no notations. If I click no, nothing happens and dialog dismisses as expected. However, If I click yes, how do call a function to refresh my view and until my view is refreshed show a progress dialog? Here's my code so far, I dont know where to dismiss the progress dialog or make sure the view is refreshed, any clues? :</p>

<pre><code>AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle("Are you sure you want to refresh your view?");
        builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                //refreshview here ? 

                ProgressDialog progressDialog = ProgressDialog.show(getActivity(), "",
                        "Loading. Please wait...", true);
                progressDialog.show();

                progressDialog.setCancelable(false);
                progressDialog.setCanceledOnTouchOutside(false);
            }
        });
        builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.dismiss();
            }
        });
        AlertDialog dialog = builder.create();
        dialog.show();
</code></pre>