Example usage for android.app ProgressDialog setCancelable

List of usage examples for android.app ProgressDialog setCancelable

Introduction

In this page you can find the example usage for android.app ProgressDialog setCancelable.

Prototype

public void setCancelable(boolean flag) 

Source Link

Document

Sets whether this dialog is cancelable with the KeyEvent#KEYCODE_BACK BACK key.

Usage

From source file:Main.java

public static ProgressDialog makeProgressDialog(Context ctx) {
    ProgressDialog p = new ProgressDialog(ctx);
    p.setCancelable(false);
    p.setCanceledOnTouchOutside(false);/*ww w . j a v a 2  s  .com*/
    p.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    p.setIndeterminate(true);
    return p;
}

From source file:Main.java

public static ProgressDialog createProgressDialog(Context context, String message) {
    ProgressDialog progress = new ProgressDialog(context);
    progress.setCancelable(true);
    progress.setMessage(message);/*from  w ww .ja v  a2  s .com*/

    return progress;
}

From source file:Main.java

public static ProgressDialog showProgressDialog(Activity context, int message,
        ProgressDialog.OnCancelListener cancelListener) {
    ProgressDialog mDialog = new ProgressDialog(context);
    mDialog.setCancelable(cancelListener != null);
    mDialog.setOnCancelListener(cancelListener);
    mDialog.setMessage(context.getString(message));
    mDialog.setIndeterminate(true);/*from  w w  w  .jav a2s.co m*/
    mDialog.show();
    return mDialog;
}

From source file:Main.java

public static ProgressDialog showProgressDialog(Context context, String message) {
    ProgressDialog dialog = ProgressDialog.show(context, "", message);
    dialog.setCancelable(true);
    return dialog;

}

From source file:Main.java

public static ProgressDialog buildProgressDialog(Context ctx, String message, boolean cancelable) {
    ProgressDialog pd = new ProgressDialog(ctx);
    pd.setMessage(message);//from  ww w .  j a  v  a2  s.c o m
    pd.setCancelable(cancelable);

    return pd;
}

From source file:Main.java

public static ProgressDialog getProcessDialog(Context context, String tips) {
    ProgressDialog dialog = new ProgressDialog(context);
    dialog.setMessage(tips);//from   w  w  w. ja v a  2 s  . c om
    dialog.setCancelable(false);
    return dialog;
}

From source file:Main.java

public static ProgressDialog setupProgressDialog(Context ctx) {
    ProgressDialog progressDialog = new ProgressDialog(ctx);
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage("Loading...");
    return progressDialog;
}

From source file:Main.java

public static ProgressDialog createProgressDialog(String message, Context context) {
    ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(true);
    progressDialog.setMessage(message);/*from   ww w .  ja va  2  s. c om*/

    return progressDialog;
}

From source file:Main.java

/**
 * Shows the ProgressDialog./*from  ww  w .j a  v  a2s  . c om*/
 *
 * @param context        -The Activity which needs the ProgressDialog.
 * @param title          -The title.
 * @param message        -The message.
 * @param cancelListener -The OnCancelListener.
 * @return - A progress dialog.
 */
public static ProgressDialog showPrgressDialog(Context context, String title, String message,
        OnCancelListener cancelListener) {
    ProgressDialog progressDialog = ProgressDialog.show(context, title, message, true);
    progressDialog.setCancelable(true);
    progressDialog.setOnCancelListener(cancelListener);

    return progressDialog;
}

From source file:Main.java

/**
 * Shows the ProgressDialog./*from w w  w . j av  a2 s . c  o m*/
 *
 * @param context        -The Activity which needs the ProgressDialog.
 * @param title          -The title.
 * @param message        -The message.
 * @param cancelListener -The OnCancelListener.
 * @return - A progress dialog.
 */
public static ProgressDialog showProgressDialog(Context context, String title, String message,
        OnCancelListener cancelListener) {
    ProgressDialog progressDialog = ProgressDialog.show(context, title, message, true);
    progressDialog.setCancelable(true);
    progressDialog.setOnCancelListener(cancelListener);

    return progressDialog;
}