Android AlertDialog Create showAlertDialog(Context context, String title, String message)

Here you can find the source of showAlertDialog(Context context, String title, String message)

Description

show Alert Dialog

License

Open Source License

Declaration

public static void showAlertDialog(Context context, String title,
            String message) 

Method Source Code

//package com.java2s;
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

public class Main {
    public static void showAlertDialog(Context context, String title,
            String message) {//w  w  w. j  a  va2 s.  c  o m
        AlertDialog dialog = new AlertDialog.Builder(context).create();
        dialog.setCancelable(true);
        dialog.setMessage(message);
        dialog.setTitle(title);
        dialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK",
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });
        dialog.show();
    }
}

Related

  1. confirmBuilder(String title, Context context, DialogInterface.OnClickListener onConfirmListener)
  2. canShowAlertDialog(Context context)
  3. buildAlertMessageNoGps(final Context context)
  4. alert(Context ctx, String msg)
  5. showAlert(Context context, String title, String message)
  6. manageAlertDialog( final Activity fourerrActivity, final String dialogTitle, final String dialogMessage)
  7. showAlertDialog(Context context, String title, String message, String btnString, DialogInterface.OnClickListener onClickListener)
  8. newYesNoDialog(final Context context, String dialogTitle, String screenMessage, int iconResourceId, OnClickListener listener)
  9. newMessageDialog(final Context context, String dialogTitle, String screenMessage, int iconResourceId)