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 void showYesNoAlert(final Context context, String title, String message, DialogInterface.OnClickListener dialogClickListener) { showCustomButtonsAlertWithListener(context, "Yes", "No", title, message, dialogClickListener); } public static void showCustomButtonsAlertWithListener(final Context context, String positiveButtonText, String negativeButtonText, String title, String message, DialogInterface.OnClickListener dialogClickListener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title).setMessage(message).setPositiveButton(positiveButtonText, dialogClickListener) .setNegativeButton(negativeButtonText, dialogClickListener).show(); } }