Android AlertDialog Create makeSimpleDialog(Activity activity, String title, String text)

Here you can find the source of makeSimpleDialog(Activity activity, String title, String text)

Description

Create a simple Dialog with an 'OK' button, a title, and a message.

License

Open Source License

Parameter

Parameter Description
activity the Activity in which the Dialog should be displayed.
title the title to display on the dialog.
text the message to display on the Dialog.

Return

an instance of

Declaration

public static Dialog makeSimpleDialog(Activity activity, String title,
        String text) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;

public class Main {
    /**/*from   www .j a  va  2s  . c om*/
     * Create a simple {@link Dialog} with an 'OK' button and a message.
     *
     * @param activity the Activity in which the Dialog should be displayed.
     * @param text the message to display on the Dialog.
     * @return an instance of {@link android.app.AlertDialog}
     */
    public static Dialog makeSimpleDialog(Activity activity, String text) {
        return (new AlertDialog.Builder(activity)).setMessage(text)
                .setNeutralButton(android.R.string.ok, null).create();
    }

    /**
     * Create a simple {@link Dialog} with an 'OK' button, a title, and a message.
     *
     * @param activity the Activity in which the Dialog should be displayed.
     * @param title the title to display on the dialog.
     * @param text the message to display on the Dialog.
     * @return an instance of {@link android.app.AlertDialog}
     */
    public static Dialog makeSimpleDialog(Activity activity, String title,
            String text) {
        return (new AlertDialog.Builder(activity)).setTitle(title)
                .setMessage(text)
                .setNeutralButton(android.R.string.ok, null).create();
    }
}

Related

  1. simpleDialogBox(Context context, String message)
  2. dismissProgressBar(ProgressDialog progressBar)
  3. showConnectionErrorDialog(Context c)
  4. showInfoDialog(String text, final Context context)
  5. makeSimpleDialog(Activity activity, String text)
  6. showDownloadDialog(final Activity activity, CharSequence stringTitle, CharSequence stringMessage, CharSequence stringButtonYes, CharSequence stringButtonNo, final String uriString)