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 void progress(ProgressDialog pdialog, String msg) {

    pdialog.setMessage(msg);/*from   ww  w. ja va  2  s  . c  om*/
    pdialog.setIndeterminate(false);
    pdialog.setCancelable(false);
    pdialog.show();
}

From source file:Main.java

/**
 * Shows the ProgressDialog.// w ww. j av a2s . co 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(false);
    progressDialog.setOnCancelListener(cancelListener);

    return progressDialog;
}

From source file:Main.java

public static ProgressDialog loader(Context context) {
    ProgressDialog loader = new ProgressDialog(context, ProgressDialog.STYLE_SPINNER);
    loader.setIndeterminate(false);//from   www.ja  v  a  2  s .  c  o m
    loader.setCancelable(false);
    return loader;
}

From source file:Main.java

public static ProgressDialog createDialog(Context ct) {
    ProgressDialog progressDialog;

    progressDialog = new ProgressDialog(ct);
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(true);
    progressDialog.setCanceledOnTouchOutside(true);

    return progressDialog;
}

From source file:Main.java

public static ProgressDialog showProgressDialog(Context context, String text) {
    if (null != context) {
        ProgressDialog dialog = new ProgressDialog(context);
        dialog.setMessage(text);//from   w ww  .j a  v a 2  s  .  co m
        dialog.setIndeterminate(true);
        dialog.setCancelable(false);
        dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
        dialog.show();
        return dialog;
    }
    return null;
}

From source file:Main.java

public static ProgressDialog showProgress(Context context, CharSequence title, CharSequence message,
        boolean indeterminate, boolean cancelable) {
    ProgressDialog dialog = new ProgressDialog(context);
    dialog.setTitle(title);//from   w w w  .j ava  2s  .  c  om
    dialog.setMessage(message);
    dialog.setIndeterminate(indeterminate);
    dialog.setCancelable(cancelable);
    dialog.show();
    return dialog;
}

From source file:Main.java

public static ProgressDialog progressDialog(Context context, String message) {
    ProgressDialog dialog = new ProgressDialog(context);
    if (message != null) {
        dialog.setMessage(message);/*from  www. java  2  s .c o  m*/
    }
    dialog.setIndeterminate(true);
    dialog.setCancelable(true);
    return dialog;
}

From source file:Main.java

public static ProgressDialog showProgress(Context context, CharSequence title, CharSequence message,
        boolean indeterminate, boolean cancelable) {
    ProgressDialog dialog = new ProgressDialog(context);
    dialog.setTitle(title);/*from  w w  w. j  a v  a 2  s.c o m*/
    dialog.setMessage(message);
    dialog.setIndeterminate(indeterminate);
    dialog.setCancelable(cancelable);
    // dialog.setDefaultButton(false);

    dialog.show();
    return dialog;
}

From source file:Main.java

public static ProgressDialog showProgressDialog(Context context, String msg) {
    ProgressDialog progressDialog = new ProgressDialog(context);
    if (!TextUtils.isEmpty(msg))
        progressDialog.setMessage(msg);//from www.j a v  a 2 s  .co m
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.show();
    return progressDialog;
}

From source file:Main.java

public static ProgressDialog showProgressDialog(Context context) {
    ProgressDialog myProgressDialog = new ProgressDialog(context);
    myProgressDialog.setMessage("Please wait...");
    myProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    myProgressDialog.show();//  w  w  w .j  a v  a2s  . c o  m
    myProgressDialog.setCancelable(false);
    myProgressDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {

        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getRepeatCount() == 0) {
                return true;
            }
            return false;
        }

    });
    return myProgressDialog;
}