Android AlertDialog Create makeSimpleDialog(Activity activity, String text)

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

Description

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

License

Open Source License

Parameter

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

Return

an instance of

Declaration

public static Dialog makeSimpleDialog(Activity activity, 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  ww w  .  ja v  a  2  s. c  o m
     * 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. makeDialogBox(Context context, String title, String message, String cancleButton, DialogInterface.OnClickListener cancelCallBack, String okayButton, DialogInterface.OnClickListener okayCallBack)
  2. simpleDialogBox(Context context, String message)
  3. dismissProgressBar(ProgressDialog progressBar)
  4. showConnectionErrorDialog(Context c)
  5. showInfoDialog(String text, final Context context)
  6. makeSimpleDialog(Activity activity, String title, String text)
  7. showDownloadDialog(final Activity activity, CharSequence stringTitle, CharSequence stringMessage, CharSequence stringButtonYes, CharSequence stringButtonNo, final String uriString)