Example usage for android.app AlertDialog.Builder setMessage

List of usage examples for android.app AlertDialog.Builder setMessage

Introduction

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

Prototype

public void setMessage(CharSequence message) 

Source Link

Usage

From source file:Main.java

/**
 * Return an Alert Dialog with one button.
 * @param context              - The Activity which needs this alert dialog.
 * @param message              - The message in the alert.
 * @param positiveBtnLabel     - The label of the positive button.
 * @param positiveClickListener- The onClickListener of the positive button.
 * @return - The generated Alert Dialog.
 *///from  w  ww  .ja v  a2 s.c o  m
public static AlertDialog.Builder getAlertDialogWithOneButton(Context context, String message,
        String positiveBtnLabel, DialogInterface.OnClickListener positiveClickListener) {

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener);

    return builder;
}

From source file:Main.java

static public void ok_dialog(Context ctx, String title, String text) {
    AlertDialog.Builder ad;
    ad = new AlertDialog.Builder(ctx);
    ad.setTitle(title);/*from   w ww  .java2s. co  m*/
    ad.setMessage(text);
    ad.setPositiveButton("Ok", null);
    ad.show();
}

From source file:Main.java

public static AlertDialog.Builder createDialog(Context context, String title, String message) {
    AlertDialog.Builder dialog = new AlertDialog.Builder(context);
    dialog.setTitle(title);/*w w w .  java  2  s . c o m*/
    dialog.setMessage(message);

    return dialog;
}

From source file:Main.java

public static void showOKAlert(Context context, String message) {

    AlertDialog.Builder builder = new AlertDialog.Builder(context);

    builder.setMessage(message).setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();//from  w w  w. ja va 2 s.co m
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:Main.java

public static void showOKAlert(Context context, int messageResourceID) {

    AlertDialog.Builder builder = new AlertDialog.Builder(context);

    builder.setMessage(messageResourceID).setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();/* w ww . ja  va  2 s .  c o m*/
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:Main.java

public static void showAlertDialog(Context context, String title, String message) {
    AlertDialog.Builder dialog = new AlertDialog.Builder(context);
    dialog.setTitle(title);/*from  w ww. j  a  v a2 s . c  o  m*/
    dialog.setMessage(message);
    dialog.setIcon(android.R.drawable.ic_dialog_alert);
    dialog.setPositiveButton(android.R.string.ok, null);
    dialog.show();
}

From source file:Main.java

public static void showDialogAlert(Context ctx, String title, String body) {
    AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
    builder.setTitle(title);/*from ww  w .j a v a 2s  .com*/
    builder.setMessage(body);
    Dialog dialogDetails = builder.create();
    dialogDetails.setCanceledOnTouchOutside(true);
    dialogDetails.show();
}

From source file:Main.java

public static void alert(final Activity activity, final String msg, final String ok, final boolean exit) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setMessage(msg).setCancelable(false).setPositiveButton(ok, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.dismiss();/*from  w  ww. j a  v  a2  s  . c  o  m*/
            if (exit) {
                activity.setResult(activity.RESULT_CANCELED);
                activity.finish();
            }
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:Main.java

public static AlertDialog.Builder getAlertDialogWithTwoButtonAndEditView(Context context, String message,
        String positiveBtnLabel, String negetiveBtnLabel, DialogInterface.OnClickListener positiveClickListener,
        DialogInterface.OnClickListener negativeClickListener, EditText input) {

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener)
            .setNegativeButton(negetiveBtnLabel, negativeClickListener);

    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT);
    input.setLayoutParams(lp);/*  w w w. ja v  a 2s  .com*/
    builder.setView(input);

    return builder;
}

From source file:Main.java

public static void showMessageDialogWithNewIntent(final Activity curentActivity, Context context,
        String message, final Class newActivity, final String extras) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(message).setCancelable(false).setPositiveButton("Ok",
            new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int id) {

                    Intent i = new Intent(curentActivity, newActivity);
                    if (extras != null) {
                        Log.i("LOGINSIGNUP", "=extras!=null in showMessageDialog");
                        i.putExtra("OAuthError", true);
                    }/*from   w w w  . j a va  2s.c om*/
                    Log.i("LOGINSIGNUP", "==after if in showMessageDialog");

                    curentActivity.startActivity(i);
                    //                  curentActivity.finish();
                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}