Here you can find the source of showAlert(Context context, String title, String message)
Parameter | Description |
---|---|
context | a parameter |
title | a parameter |
message | a parameter |
public static void showAlert(Context context, String title, String message)
//package com.java2s; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; public class Main { /**/*from w ww . java 2 s . c o m*/ * * @param context * @param title * @param message */ public static void showAlert(Context context, String title, String message) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( context); alertDialogBuilder .setTitle(title) .setMessage(message) .setCancelable(false) .setNeutralButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // if this button is clicked, close // current activity dialog.dismiss(); } }); AlertDialog alertDialog = alertDialogBuilder.create(); // show it alertDialog.show(); } }