Android AlertDialog Create createAlertDialog(Context cx, String title, String message)

Here you can find the source of createAlertDialog(Context cx, String title, String message)

Description

create Alert Dialog

Declaration

public static AlertDialog.Builder createAlertDialog(Context cx,
            String title, String message) 

Method Source Code

//package com.java2s;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

public class Main {
    public static AlertDialog.Builder createAlertDialog(Context cx,
            String title, String message) {
        return new AlertDialog.Builder(cx)
                .setTitle(title)/*ww  w  .  j  a va  2s  .  com*/
                .setMessage(message)
                .setPositiveButton("Yes",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int which) {
                                // continue with delete
                            }
                        })
                .setNegativeButton("No",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int which) {
                                // do nothing
                            }
                        });
    }
}

Related

  1. showInfoDialog(Context context, String message, String titleStr, String positiveStr, DialogInterface.OnClickListener onClickListener)
  2. alert(Context act, String msg)
  3. alert(Context act, int strId)
  4. showErrorDialog(Context context, int title, int message)
  5. showAlertDialog(Activity ctx, String title, String text)
  6. alert(String title, String message, Context context)
  7. alert(String title, String message, Context context, boolean linksClickable)
  8. confirm(String title, String message, Context context, DialogInterface.OnClickListener onConfirmListener)
  9. confirm(String title, View view, Context context, DialogInterface.OnClickListener onConfirmListener)