Java tutorial
//package com.java2s; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.content.Context; import android.content.DialogInterface; public class Main { static public void showAlertDialogWithTitle(Context context, int titleResource, int stringResource, DialogInterface.OnClickListener positiveListener) { AlertDialog.Builder builder = new Builder(context); builder.setTitle(titleResource); builder.setMessage(stringResource); builder.setPositiveButton(android.R.string.ok, positiveListener); builder.create().show(); } static public void showAlertDialogWithTitle(Context context, int titleResource, int stringResource) { showAlertDialogWithTitle(context, titleResource, stringResource, null); } }