ProgressDialog pd = ProgressDialog.show(this, "Loading", "Please Wait", true);
pd.cancel();
pd.dismiss();