Example usage for android.app ProgressDialog ProgressDialog

List of usage examples for android.app ProgressDialog ProgressDialog

Introduction

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

Prototype

public ProgressDialog(Context context) 

Source Link

Document

Creates a Progress dialog.

Usage

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 void showProgressDialog(Context context, String msg) {
    if (context == null)
        return;/*from   ww w  .j av  a 2  s  .  c  om*/

    mProgressDialog = new ProgressDialog(context);
    mProgressDialog.setMessage(msg);
    mProgressDialog.setCancelable(false);
    if (!mProgressDialog.isShowing()) {
        mProgressDialog.show();
    }
}

From source file:Main.java

public static void showProgressDlg(Context ctx, String strMessage) {

    if (null == progressDlg) {
        if (ctx == null)
            return;
        progressDlg = new ProgressDialog(ctx);
        progressDlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progressDlg.setMessage(strMessage);
        progressDlg.setIndeterminate(false);
        progressDlg.setCancelable(true);
        progressDlg.show();// www  . j  a  v a 2  s .co  m
    }
}

From source file:Main.java

private static synchronized void initDialog(Context ctx, String s) {
    if (loadingDialog == null && ctx != null) {
        loadingDialog = new ProgressDialog(ctx);
        loadingDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        loadingDialog.setMessage(s);// w w  w  .ja v a 2 s  .  c  o  m
        loadingDialog.setCanceledOnTouchOutside(false);
    } else if (loadingDialog != null && ctx != null && loadingDialog.isShowing()) {
        loadingDialog.dismiss();
    }
}

From source file:Main.java

public static ProgressDialog getCustomProgressDialog(Context context, String content,
        boolean canceledOnTouchOutside, int dialogTheam) {
    ProgressDialog progressDialog = dialogTheam == 0 ? new ProgressDialog(context)
            : new ProgressDialog(context, dialogTheam);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage(content);/*from w ww . j a  v a 2  s.  co m*/
    progressDialog.setIndeterminate(true);
    progressDialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
    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();//from ww  w  .j av  a 2  s.com
    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;
}

From source file:Main.java

private static ProgressDialog createProgressDialog(Context context, String message) {

    ProgressDialog dialog = new ProgressDialog(context);
    dialog.setIndeterminate(false);//ww w .  j a  v  a  2s.  c  o  m
    dialog.setMessage(message);

    return dialog;
}

From source file:Main.java

public static ProgressDialog startProgressBar(final Activity activity) {
    activity.runOnUiThread(new Runnable() {

        public void run() {
            // pBar = ProgressBar.makeText(activity, text, duration);
            pDialog = new ProgressDialog(activity);
            pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            pDialog.setMessage("Laden");
            pDialog.setCancelable(false);
            pDialog.show();/*w  w  w  . j a  v a  2 s. c  o  m*/
        }
    });

    return pDialog;
}

From source file:Main.java

public static ProgressDialog createProgressDialog(final Activity activity, int progressDialogTitleId,
        int progressDialogMsgId) {
    ProgressDialog progressDialog = new ProgressDialog(activity);
    if (progressDialogTitleId > 0) {
        progressDialog.setTitle(progressDialogTitleId);
    } else {// w  w  w.  ja v a2  s . co m
        progressDialog.setTitle(activity.getResources().getIdentifier(PROGRESS_DIALOG_TITLE_RESOURCE, "string",
                activity.getPackageName()));
    }
    if (progressDialogMsgId > 0) {
        progressDialog.setMessage(activity.getString(progressDialogMsgId));
    } else {
        progressDialogMsgId = activity.getResources().getIdentifier(PROGRESS_DIALOG_MESSAGE_RESOURCE, "string",
                activity.getPackageName());
        progressDialog.setMessage(activity.getString(progressDialogMsgId));
    }
    progressDialog.setIndeterminate(true);
    progressDialog.setOnKeyListener(new OnKeyListener() {
        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            activity.onKeyDown(keyCode, event);
            return false;
        }
    });
    // progressDialog.setInverseBackgroundForced(true);
    return progressDialog;
}

From source file:MainActivity.java

public void startProgress(View view) {
    mDialog = new ProgressDialog(this);
    mDialog.setMessage("Doing something...");
    mDialog.setCancelable(false);/*w w w .j a  v a  2s  .  c om*/
    mDialog.show();
    new Handler().postDelayed(new Runnable() {
        public void run() {
            mDialog.dismiss();
        }
    }, THIRTY_SECONDS);
}