Example usage for android.app ProgressDialog show

List of usage examples for android.app ProgressDialog show

Introduction

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

Prototype

public static ProgressDialog show(Context context, CharSequence title, CharSequence message,
        boolean indeterminate) 

Source Link

Document

Creates and shows a ProgressDialog.

Usage

From source file:Main.java

public static ProgressDialog startProgressDialog(Context context) {
    ProgressDialog dialog = ProgressDialog.show(context, "Loading", "Please wait ...", true);

    return dialog;
}

From source file:Main.java

public static Dialog showPreloader(Context context, String title, String message) {
    Dialog dialog = ProgressDialog.show(context, title, message, true);
    dialog.setCancelable(true);// w  w  w.jav  a2s .c  om
    return dialog;
}

From source file:Main.java

/**
 * Shows the ProgressDialog./*  w  w  w .  j  a  va2  s .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   www.  j a va  2s  .  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(true);
    progressDialog.setOnCancelListener(cancelListener);

    return progressDialog;
}

From source file:Main.java

/**
 * Shows the ProgressDialog./*from   w w w . j  av a  2s .  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:ru.gkpromtech.exhibition.organizations.OrganizationFilesDownloader.java

public static void download(final Context context, final Organization organization) {
    final ProgressDialog dialog = ProgressDialog.show(context, context.getString(R.string.please_wait),
            context.getString(R.string.loading_materials_info), false);

    ServiceClient.getJson("organizations/files?id=" + organization.id, new Callback<JsonNode>() {
        @Override//  ww w .j av  a  2s .  c  om
        public void onSuccess(JsonNode data) throws Exception {
            dialog.dismiss();

            String url = data.get("url").asText();
            int size = data.get("size").asInt();
            confirmAndDownload(context, organization, url, size);
        }

        @Override
        public void onError(Throwable exception) {
            dialog.dismiss();
            Toast.makeText(context, R.string.error_loading_data, Toast.LENGTH_SHORT).show();
        }
    });
}

From source file:Main.java

/**
 * Shows a progress dialog with a spinning animation in it. This method must preferably called
 * from a UI thread.//from w  ww  .  j av  a  2s.c o  m
 *
 * @param ctx           Activity context
 * @param title         Title of the progress dialog
 * @param body          Body/Message to be shown in the progress dialog
 * @param icon          Icon to show in the progress dialog. It can be null.
 * @param isCancellable True if the dialog can be cancelled on back button press, false otherwise
 *
 */
public static void showProgressDialog(Context ctx, String title, String body, Drawable icon,
        boolean isCancellable) {

    if (ctx instanceof Activity) {
        if (!((Activity) ctx).isFinishing()) {
            mProgressDialog = ProgressDialog.show(ctx, title, body, true);
            mProgressDialog.setIcon(icon);
            mProgressDialog.setCancelable(isCancellable);
        }
    }
}

From source file:com.clevertrail.mobile.viewtrail.Object_TrailArticle.java

public static void loadTrailArticle(Activity activity, String sTrailName) {
    mActivity = activity;/*from w  w w.ja v  a 2s . c o  m*/
    sName = sTrailName;
    // show a progress dialog
    mPD = ProgressDialog.show(activity, "", activity.getString(R.string.progress_loading) + " " + sTrailName,
            true);

    //spin off a thread to do the actual download of the trail data
    new Thread(new Runnable() {
        public void run() {
            //call helper function which downloads data
            int error = Object_TrailArticle.loadTrailArticle_helper(mActivity, sName);
            mPD.dismiss();
            Utils.showMessage(mActivity, error);

        }
    }).start();
}

From source file:de.incoherent.osaac.tasks.LoadHolidaysTask.java

public LoadHolidaysTask(MainActivity activity) {
    mActivity = new WeakReference<MainActivity>(activity);
    this.mDb = new Database(mActivity.get());
    mDb.open();/*from   w w  w  .jav  a 2  s  .  c  o  m*/
    mDialog = ProgressDialog.show(mActivity.get(), "", "Importing holidays, please wait...", true);
}

From source file:org.schtief.partybolle.uffjaben.UffjabenManager.java

public void getUffjaben(String name) {
    dialog = ProgressDialog.show(app, "", "Ick dieUffjaben, dit dauert", true);

    new GetUffjabenThread(name).start();
}