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 two buttons.
 * @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 negetiveBtnLabel     - The label of the negative button.
 * @param positiveClickListener- The onClickListener of the positive button.
 * @param negativeClickListener- The onClickListener of the negative button.
 * @return - The generated Alert Dialog.
 *//*from w ww  .j  a  v  a 2 s .  c  o m*/
public static AlertDialog.Builder getAlertDialogWithTwoButton(Context context, String message,
        String positiveBtnLabel, String negetiveBtnLabel, DialogInterface.OnClickListener positiveClickListener,
        DialogInterface.OnClickListener negativeClickListener) {

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

    return builder;
}

From source file:Main.java

static public void showAlertDialogWithTitle(Context context, int titleResource, int stringResource,
        DialogInterface.OnClickListener positiveListener) {
    AlertDialog.Builder builder = new Builder(context);
    builder.setTitle(titleResource);/*ww w  . ja va2s. c om*/
    builder.setMessage(stringResource);
    builder.setPositiveButton(android.R.string.ok, positiveListener);
    builder.create().show();
}

From source file:Main.java

public static final void showAlertDialog(Activity ctx, String title, String text) {
    AlertDialog.Builder alertBuilder = new AlertDialog.Builder(ctx);
    alertBuilder.setTitle(title);//  w ww.  j ava 2 s. c o  m
    alertBuilder.setMessage(text);
    AlertDialog alert = alertBuilder.create();
    alert.show();
}

From source file:Main.java

/**
 * //from w w w  . jav  a  2  s  .  c o  m
 * @param title
 * @param message
 */
public static void showDialog(String title, String message, Activity activity) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle(title);
    builder.setMessage(message);
    builder.setPositiveButton("Yes", null);
    builder.create().show();
}

From source file:Main.java

public static AlertDialog makeAlertDialog(Context context, int titleId, int messageId, int postiveId,
        OnClickListener positiveListener, int NegativeId, OnClickListener negativeListener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(titleId);/*from  ww w  .j  av  a2s . c  o m*/
    builder.setMessage(messageId);
    builder.setPositiveButton(postiveId, positiveListener);
    builder.setNegativeButton(NegativeId, negativeListener);
    return builder.create();
}

From source file:Main.java

public static AlertDialog create(Context context, int message,
        DialogInterface.OnClickListener onClickListener) {
    android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context);
    builder.setMessage(message);
    builder.setPositiveButton(android.R.string.ok, onClickListener);
    return builder.create();
}

From source file:Main.java

public static void showDialog(Context context, String title, String message, String buttonText,
        DialogInterface.OnClickListener buttonClickListener) {
    AlertDialog.Builder dlg = new AlertDialog.Builder(context);
    dlg.setTitle(title);//from   w w  w.j a va 2 s .c  om
    dlg.setMessage(message);
    dlg.setCancelable(false);
    dlg.setPositiveButton(buttonText, buttonClickListener);
    dlg.create();
    dlg.show();
}

From source file:Main.java

public static void alert(String title, String message, Activity activity,
        DialogInterface.OnClickListener listener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle(title);//from   www .j  a v  a 2  s  .  co  m
    builder.setMessage(message);
    builder.setPositiveButton("OK", listener);
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:Main.java

/**
 * /*from  ww w . j a v a2  s.  co  m*/
 * @param context
 * @param strTitle
 * @param strText
 * @param icon
 */
public static void showDialog(Activity context, String strTitle, String strText, int icon) {
    AlertDialog.Builder tDialog = new AlertDialog.Builder(context);
    tDialog.setTitle(strTitle);
    tDialog.setMessage(strText);
    tDialog.setPositiveButton(android.R.string.ok, null);
    tDialog.show();
}

From source file:Main.java

public static void showMessage(Context _context, String title, String message, int icon,
        DialogInterface.OnClickListener ackHandler) {
    AlertDialog.Builder builder = new AlertDialog.Builder(_context);
    builder.setTitle(title);//from  ww w .j ava  2  s.  c  o  m
    builder.setMessage(Html.fromHtml(message));
    builder.setCancelable(false);
    builder.setPositiveButton("Acknowledged", ackHandler);
    builder.setIcon(icon);
    builder.show();
}