Java tutorial
//package com.java2s; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; public class Main { static public void showAlert(Context ctx, final String message) { AlertDialog alertDialog = new AlertDialog.Builder(ctx).create(); alertDialog.setTitle("Application Error"); alertDialog.setMessage(message); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "Dismiss", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Do nothing } }); alertDialog.show(); } }