Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; public class Main { public static AlertDialog AlertLog(Context ctx, String msg, String btn) { AlertDialog.Builder alertbox = new AlertDialog.Builder(ctx); alertbox.setMessage(msg); alertbox.setNegativeButton(btn, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); return alertbox.create(); } }