Java tutorial
//package com.java2s; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface.OnClickListener; public class Main { public static AlertDialog makeAlertDialog(Context context, int titleId, int messageId, int postiveId, OnClickListener positiveListener, int NegativeId, OnClickListener negativeListener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(titleId); builder.setMessage(messageId); builder.setPositiveButton(postiveId, positiveListener); builder.setNegativeButton(NegativeId, negativeListener); return builder.create(); } }