Android AlertDialog Create manageAlertDialog( final Activity fourerrActivity, final String dialogTitle, final String dialogMessage)

Here you can find the source of manageAlertDialog( final Activity fourerrActivity, final String dialogTitle, final String dialogMessage)

Description

manage Alert Dialog

Declaration

public static Runnable manageAlertDialog(
            final Activity fourerrActivity, final String dialogTitle,
            final String dialogMessage) 

Method Source Code

//package com.java2s;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;

public class Main {
    public static final String OK = "OK";

    public static Runnable manageAlertDialog(
            final Activity fourerrActivity, final String dialogTitle,
            final String dialogMessage) {

        return new Runnable() {

            public void run() {
                final AlertDialog alertDialog = buildAlertDialog(
                        dialogTitle, dialogMessage);
                alertDialog.show();/*from  w  w  w  .  ja  va2  s. c o m*/
            }

            private AlertDialog buildAlertDialog(final String dialogTitle,
                    final String dialogMessage) {

                final AlertDialog alertDialog = new AlertDialog.Builder(
                        fourerrActivity).create();
                alertDialog.setTitle(dialogTitle);
                alertDialog.setMessage(dialogMessage);
                alertDialog.setButton(OK,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int which) {
                                fourerrActivity
                                        .setResult(Activity.RESULT_OK);
                                fourerrActivity.finish();
                                return;
                            }
                        });

                return alertDialog;

            }
        };
    }
}

Related

  1. canShowAlertDialog(Context context)
  2. buildAlertMessageNoGps(final Context context)
  3. alert(Context ctx, String msg)
  4. showAlert(Context context, String title, String message)
  5. showAlertDialog(Context context, String title, String message)
  6. showAlertDialog(Context context, String title, String message, String btnString, DialogInterface.OnClickListener onClickListener)
  7. newYesNoDialog(final Context context, String dialogTitle, String screenMessage, int iconResourceId, OnClickListener listener)
  8. newMessageDialog(final Context context, String dialogTitle, String screenMessage, int iconResourceId)
  9. showAuthenticatedDialog(Context context, String title, String text)