Here you can find the source of showAlertDialog(Context context, String title, String message)
public static void showAlertDialog(Context context, String title, String message)
//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(); } }