Java tutorial
//package com.java2s; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; public class Main { static public void showDialogBox(String message, Context context) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); alertDialogBuilder.setMessage(message); alertDialogBuilder.setNegativeButton("cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } }