Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; public class Main { /** * Alert and quite the activity * @param message */ public static void alertAbort(final Activity activity, String message) { new AlertDialog.Builder(activity, AlertDialog.THEME_HOLO_DARK).setTitle("Problem...").setMessage(message) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { activity.finish(); } }).setIcon(android.R.drawable.ic_dialog_alert).show(); } }