Java tutorial
//package com.java2s; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; public class Main { public static void DialogOK(Context ctx, String text) { AlertDialog.Builder builder = new AlertDialog.Builder(ctx); builder.setMessage(text).setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); } }