Android Progress Dialog Create hideProgressDialog()

Here you can find the source of hideProgressDialog()

Description

This method will hide existing progress dialog.
It will not throw any Exception if there is no progress dialog on the screen and can also be called from non UI threads.

Declaration

public static void hideProgressDialog() 

Method Source Code

//package com.java2s;

import android.app.Activity;

import android.app.ProgressDialog;

public class Main {
    public static Activity mSmartAndroidActivity;
    private static ProgressDialog progress = null;

    /**/*ww  w . java  2  s . c o m*/
     * This method will hide existing progress dialog.<br>
     * It will not throw any Exception if there is no progress dialog on the
     * screen and can also be called from non UI threads.
     */
    public static void hideProgressDialog() {
        mSmartAndroidActivity.runOnUiThread(new Runnable() {

            @Override
            public void run() {
                try {
                    if (progress.isShowing())
                        progress.dismiss();
                } catch (Throwable e) {

                }
            }
        });
    }
}

Related

  1. stallWithProgressDialog(Context context, String title, String msg, boolean indeter, boolean cancelable, int stallTime)
  2. showProgressDialog(Context mContext, CharSequence processMessage)
  3. showProgressDialog(Context c, String title, String msg)
  4. showProgressDialog(String msg)
  5. showProgressDialog(String msg, final boolean isCancellable)
  6. showProgressBar(ProgressDialog progressBar, String message)