Java tutorial
//package com.java2s; //License from project: Apache License import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; public class Main { public static void showMessage(String message, Context context) { AlertDialog alertDialog = new AlertDialog.Builder(context).create(); alertDialog.setTitle("New Message"); alertDialog.setMessage(message); alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.show(); } }