Example usage for android.app AlertDialog.Builder create

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

Introduction

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

Prototype

public void create() 

Source Link

Document

Forces immediate creation of the dialog.

Usage

From source file:Main.java

public static Dialog createMessageDialog(Context context, String message) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(message).setCancelable(true);
    AlertDialog alert = builder.create();
    return alert;
}

From source file:Main.java

public static AlertDialog createAlertDialog(Activity activity, String message, String title) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setMessage(message);/*from  w w  w  .j  a  v  a  2s.c  o m*/
    builder.setNeutralButton("OK", null);
    return builder.create();
}

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  a2 s.co m
    builder.setMessage(body);
    Dialog dialogDetails = builder.create();
    dialogDetails.setCanceledOnTouchOutside(true);
    dialogDetails.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);/*from w w w  .j  a va  2 s  .  co m*/
    alertBuilder.setMessage(text);
    AlertDialog alert = alertBuilder.create();
    alert.show();
}

From source file:Main.java

public static void showProgressDialog(Context mCtx, String msg) {
    final AlertDialog.Builder builder = new AlertDialog.Builder(mCtx);
    builder.setMessage(msg);/*from  w  w w.j av  a  2s  .c  o m*/
    builder.setCancelable(false);

    final AlertDialog dialog = builder.create();
    dialog.show();
}

From source file:Main.java

/**
 * @param s//from w  w w.j  a v  a  2s .c  o  m
 *            The alert message Displays an alert dialog with the messaged
 *            provided
 */
public static void showAlert(Context context, String mesg) {
    AlertDialog.Builder alt_bld = new AlertDialog.Builder(context);
    alt_bld.setMessage(mesg).setPositiveButton(android.R.string.ok, null);
    AlertDialog alert = alt_bld.create();
    alert.show();
}

From source file:Main.java

/**
 * create dialog//from  www.j  a v  a 2 s .c o m
 */

public static void callDialog(Context ctx, String msg, String title) {

    AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
    builder.setMessage(msg).setTitle(title).setPositiveButton(android.R.string.ok, null);
    AlertDialog dialog = builder.create();
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
}

From source file:Main.java

static void alert(Activity act, String Tag, String message) {
    AlertDialog.Builder bld = new AlertDialog.Builder(act);
    bld.setMessage(message);//from w w w  .  j  a v  a  2s.c o m
    bld.setNeutralButton("OK", null);
    Log.d(Tag, "Showing alert dialog: " + message);
    bld.create().show();
}

From source file:Main.java

/**
 * //www .  java2 s .  c  om
 * @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 void alert(String title, String message, Activity activity,
        DialogInterface.OnClickListener listener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle(title);/*from   ww w . j  av a  2  s.  c om*/
    builder.setMessage(message);
    builder.setPositiveButton("OK", listener);
    AlertDialog alert = builder.create();
    alert.show();
}