Java tutorial
//package com.java2s; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; public class Main { public static void showAlert(Context context, String title, String msg, String button) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title).setMessage(msg).setCancelable(false) .setPositiveButton(button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).show(); } }