Java tutorial
//package com.java2s; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; public class Main { public static final Dialog createErrorAlert(final Context context, final String title, final String message) { final AlertDialog.Builder builder = new AlertDialog.Builder(context); final Dialog dialog = builder.setTitle(title).setMessage(message) .setIcon(android.R.drawable.ic_dialog_alert).setNeutralButton("OK", null).create(); return dialog; } }