Android Utililty Methods AlertDialog Create

List of utility methods to do AlertDialog Create

Description

The list of methods to do AlertDialog Create are organized into topic(s).

Method

voidshowAlertText(String alertText, Context context)
show Alert Text
Toast.makeText(context, alertText, Toast.LENGTH_LONG).show();
voidshowInfoDialog(Context context, String message, String titleStr, String positiveStr, DialogInterface.OnClickListener onClickListener)
show Info Dialog
AlertDialog.Builder localBuilder = new AlertDialog.Builder(context);
localBuilder.setTitle(titleStr);
localBuilder.setMessage(message);
if (onClickListener == null)
    onClickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
    };
localBuilder.setPositiveButton(positiveStr, onClickListener);
localBuilder.show();
voidalert(Context act, String msg)
alert
AlertDialog.Builder builder = new AlertDialog.Builder(act);
builder.setMessage(msg);
alert = builder.create();
alert.show();
voidalert(Context act, int strId)
alert
String msg = act.getResources().getString(strId);
alert(act, msg);
voidshowErrorDialog(Context context, int title, int message)
show Error Dialog
new AlertDialog.Builder(context).setTitle(context.getString(title))
        .setMessage(context.getString(message))
        .setPositiveButton(android.R.string.ok, null).create()
        .show();
voidshowAlertDialog(Activity ctx, String title, String text)
show Alert Dialog
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(ctx);
alertBuilder.setTitle(title);
alertBuilder.setMessage(text);
AlertDialog alert = alertBuilder.create();
alert.show();
AlertDialog.BuildercreateAlertDialog(Context cx, String title, String message)
create Alert Dialog
return new AlertDialog.Builder(cx)
        .setTitle(title)
        .setMessage(message)
        .setPositiveButton("Yes",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                            int which) {
                })
        .setNegativeButton("No",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,
                            int which) {
                });
voidalert(String title, String message, Context context)
alert
alert(title, message, context, false);
voidalert(String title, String message, Context context, boolean linksClickable)
alert
SpannableString spannableString = new SpannableString(message);
if (linksClickable) {
    Linkify.addLinks(spannableString, Linkify.ALL);
AlertDialog dialog = new AlertDialog.Builder(context)
        .setTitle(title).setMessage(spannableString)
        .setPositiveButton(android.R.string.ok, null).create();
dialog.show();
...
Dialogconfirm(String title, String message, Context context, DialogInterface.OnClickListener onConfirmListener)
confirm
return confirmBuilder(title, context, onConfirmListener)
        .setMessage(message).show();