Java tutorial
//package com.java2s; import android.app.Activity; import android.app.ProgressDialog; public class Main { public static ProgressDialog progressDialog; public static void hideProgressDialog(Activity activity) { activity.runOnUiThread(new Runnable() { @Override public void run() { if (progressDialog != null) { if (progressDialog.isShowing()) { progressDialog.dismiss(); } } } }); } }