Java tutorial
//package com.java2s; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; public class Main { public static void showWarningDialogStatic(String title, String message, Context ctx) { AlertDialog alertDialog = new AlertDialog.Builder(ctx).create(); alertDialog.setTitle(title); alertDialog.setMessage(message); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // here you can add functions } }); alertDialog.show(); } }