Example usage for android.app ProgressDialog setMessage

List of usage examples for android.app ProgressDialog setMessage

Introduction

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

Prototype

@Override
    public void setMessage(CharSequence message) 

Source Link

Usage

From source file:Main.java

public static Dialog setLoadingDialog(Activity activity, String message) {
    ProgressDialog progressDialog = new ProgressDialog(activity);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage(message);
    return progressDialog;
}

From source file:Main.java

public static ProgressDialog creativeProgressBar(Context context, String comment) {
    ProgressDialog dialog = new ProgressDialog(context);
    if (comment == null)
        dialog.setMessage("Please wait while loading...");
    else//from w  w  w. j  a va  2  s. c o m
        dialog.setMessage(comment);

    dialog.setIndeterminate(true);
    dialog.setCancelable(true);
    return dialog;
}

From source file:Main.java

public static ProgressDialog createProgressDialog(String message, Context context) {
    ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(true);//from  w  ww  .  j av a2 s .  co  m
    progressDialog.setMessage(message);

    return progressDialog;
}

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  a 2  s . c om*/
    mDialog.show();
    return mDialog;
}

From source file:Main.java

public static ProgressDialog createProgressSpinner(Context context, String title, String message) {
    ProgressDialog dialog = null;
    if (dialog == null) {
        dialog = ProgressDialog.show(context, title, message);
    } else {//from   w  w w  . j av  a2s .  co m
        dialog.setTitle(title);
        dialog.setMessage(message);
    }
    dialog.show();

    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 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);
    progressDialog.setIndeterminate(true);
    progressDialog.setCanceledOnTouchOutside(canceledOnTouchOutside);
    return progressDialog;
}

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 {//from w  w w.  ja  v  a 2s. c om
        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:de.wikilab.android.friendica01.Max.java

/**
* Calls the api method <code>verify_credentials</code> with the login data
 * saved in the <code>SharedPreferences</code>. Calls ctx.OnLogin on success,
 * showLoginForm(ctx, "error") on error//from ww  w.  j ava  2s  .  c o m
* @param ctx     MUST IMPLEMENT LoginListener !!!
*/
public static void tryLogin(final Activity ctx) {

    final ProgressDialog pd = new ProgressDialog(ctx);
    pd.setMessage(ctx.getResources().getString(R.string.logging_in));
    pd.show();

    String server = Max.getServer(ctx);
    Log.i(TAG, "tryLogin on server " + server);

    final TwAjax t = new TwAjax(ctx, true, true);
    t.getUrlContent(server + "/api/account/verify_credentials", new Runnable() {
        @Override
        public void run() {
            pd.dismiss();
            try {
                if (t.isSuccess()) {
                    Log.i(TAG, "... tryLogin - http status: " + t.getHttpCode());
                    if (t.getHttpCode() == 200) {
                        JSONObject r = (JSONObject) t.getJsonResult();
                        String name = r.getString("name");
                        ((TextView) ctx.findViewById(R.id.selected_clipboard)).setText(name);
                        ((LoginListener) ctx).OnLogin();

                        final TwAjax profileImgDl = new TwAjax();
                        final String targetFs = IMG_CACHE_DIR + "/my_profile_pic_" + r.getString("id") + ".jpg";
                        if (new File(targetFs).isFile()) {
                            ((ImageView) ctx.findViewById(R.id.profile_image))
                                    .setImageURI(Uri.parse("file://" + targetFs));
                        } else {
                            profileImgDl.urlDownloadToFile(r.getString("profile_image_url"), targetFs,
                                    new Runnable() {
                                        @Override
                                        public void run() {
                                            ((ImageView) ctx.findViewById(R.id.profile_image))
                                                    .setImageURI(Uri.parse("file://" + targetFs));
                                        }
                                    });
                        }

                    } else {
                        showLoginForm(ctx, "Error: " + t.getResult());
                    }
                } else {
                    Log.w(TAG, "... tryLogin - request failed");
                    showLoginForm(ctx, "ERR: " + t.getError().toString());
                }

            } catch (Exception ex) {
                Log.w(TAG, "... tryLogin - exception:");
                ex.printStackTrace();
                showLoginForm(ctx, "ERR2: " + t.getResult() + ex.toString());

            }
        }
    });
}

From source file:com.nextgis.mobile.map.LocalTMSLayer.java

protected static void create(final MapBase map, String layerName, int tmsType, Uri uri) {
    String sErr = map.getContext().getString(R.string.error_occurred);
    try {//from w  w w  .j a  v a 2  s. c om
        InputStream inputStream = map.getContext().getContentResolver().openInputStream(uri);
        if (inputStream != null) {
            ProgressDialog progressDialog = new ProgressDialog(map.getContext());
            progressDialog.setMessage(map.getContext().getString(R.string.message_zip_extract_progress));
            progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            progressDialog.setCancelable(true);
            progressDialog.show();

            File outputPath = map.cretateLayerStorage();
            //create layer description file
            JSONObject oJSONRoot = new JSONObject();
            oJSONRoot.put(JSON_NAME_KEY, layerName);
            oJSONRoot.put(JSON_VISIBILITY_KEY, true);
            oJSONRoot.put(JSON_TYPE_KEY, LAYERTYPE_LOCAL_TMS);
            oJSONRoot.put(JSON_TMSTYPE_KEY, tmsType);

            new UnZipTask(map.getMapEventsHandler(), inputStream, outputPath, oJSONRoot, progressDialog)
                    .execute();
            return;
        }
    } catch (FileNotFoundException e) {
        Log.d(TAG, "Exception: " + e.getLocalizedMessage());
        sErr += ": " + e.getLocalizedMessage();
    } catch (JSONException e) {
        Log.d(TAG, "Exception: " + e.getLocalizedMessage());
        sErr += ": " + e.getLocalizedMessage();
    }
    //if we here something wrong occurred
    Toast.makeText(map.getContext(), sErr, Toast.LENGTH_SHORT).show();
}