Android examples for User Interface:Alert Dialog
show Alert Dialog and set OK action
//package com.java2s; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; public class Main { public static void showAlertDialog(Context context, String title, String message, Boolean status) { AlertDialog alertDialog = new AlertDialog.Builder(context).create(); // Setting Dialog Title alertDialog.setTitle(title);//from ww w .ja v a 2 s .co m // Setting Dialog Message alertDialog.setMessage(message); // Setting alert dialog icon alertDialog.setIcon(android.R.drawable.ic_dialog_alert); // Setting OK Button alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); // Showing Alert Message alertDialog.show(); } }