Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; public class Main { /** * General Purpose AlertDialog*/ public static AlertDialog showMessageAlertDialog(Context context, String message, String title, DialogInterface.OnClickListener listener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(message); builder.setPositiveButton(android.R.string.ok, listener); AlertDialog dialog = builder.create(); dialog.show(); return dialog; } /** * General Purpose AlertDialog*/ public static AlertDialog showMessageAlertDialog(Context context, int message, int title, DialogInterface.OnClickListener listener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(message); builder.setPositiveButton(android.R.string.ok, listener); AlertDialog dialog = builder.create(); dialog.show(); return dialog; } }