Here you can find the source of showProgressDialog(String msg, final boolean isCancellable)
Parameter | Description |
---|---|
msg | = String msg to be displayed in progress dialog. |
isCancellable | = is cancellable or not |
public static void showProgressDialog(String msg, final boolean isCancellable)
//package com.java2s; import android.app.Activity; import android.app.ProgressDialog; public class Main { public static Activity mSmartAndroidActivity; private static ProgressDialog progress = null; private static String progressMsg = ""; /**/*from ww w . ja v a2s .co m*/ * This method will show the progress dialog with given message in the given * activity's context.<br> * The progress dialog will be non cancellable by default. User can not * dismiss it by pressing back IjoomerButton. * * @param msg * = String msg to be displayed in progress dialog. screen each * time this method is called. */ public static void showProgressDialog(String msg) { progressMsg = msg; mSmartAndroidActivity.runOnUiThread(new Runnable() { public void run() { progress = ProgressDialog.show(mSmartAndroidActivity, "", progressMsg); } }); } /** * This method will show the progress dialog with given message in the given * activity's context.<br> * The progress dialog can be set cancellable by passing appropriate flag in * parameter. User can dismiss the current progress dialog by pressing back * IjoomerButton if the flag is set to <b>true</b>; This method can also be * called from non UI threads. * * @param msg * = String msg to be displayed in progress dialog. * @param isCancellable * = is cancellable or not */ public static void showProgressDialog(String msg, final boolean isCancellable) { progressMsg = msg; mSmartAndroidActivity.runOnUiThread(new Runnable() { public void run() { progress = ProgressDialog.show(mSmartAndroidActivity, "", progressMsg); progress.setCancelable(isCancellable); } }); } }