Android AlertDialog Create newMessageDialog(final Context context, String dialogTitle, String screenMessage, int iconResourceId)

Here you can find the source of newMessageDialog(final Context context, String dialogTitle, String screenMessage, int iconResourceId)

Description

Creates a new AlertDialog to display a simple message

License

Apache License

Parameter

Parameter Description
context a parameter
dialogTitle a parameter
screenMessage a parameter
iconResourceId a parameter

Declaration

public static AlertDialog newMessageDialog(final Context context,
        String dialogTitle, String screenMessage, int iconResourceId) 

Method Source Code

//package com.java2s;
/* Copyright (c) 2009 Matthias K?ppler
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License./*from   ww  w  . jav  a2  s. c o m*/
 */

import android.app.AlertDialog;

import android.content.Context;
import android.content.DialogInterface;

import android.content.DialogInterface.OnClickListener;

public class Main {
    /**
     * Creates a new AlertDialog to display a simple message
     * 
     * @param context
     * @param dialogTitle
     * @param screenMessage
     * @param iconResourceId
     * @return
     */
    public static AlertDialog newMessageDialog(final Context context,
            String dialogTitle, String screenMessage, int iconResourceId) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setCancelable(false);
        builder.setPositiveButton("Okay", new OnClickListener() {

            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });

        builder.setTitle(dialogTitle);
        builder.setMessage(screenMessage);
        builder.setIcon(iconResourceId);

        return builder.create();
    }
}

Related

  1. showAlert(Context context, String title, String message)
  2. showAlertDialog(Context context, String title, String message)
  3. manageAlertDialog( final Activity fourerrActivity, final String dialogTitle, final String dialogMessage)
  4. showAlertDialog(Context context, String title, String message, String btnString, DialogInterface.OnClickListener onClickListener)
  5. newYesNoDialog(final Context context, String dialogTitle, String screenMessage, int iconResourceId, OnClickListener listener)
  6. showAuthenticatedDialog(Context context, String title, String text)
  7. showMessageDialog(Context context, String title, String strText)
  8. showSingleDialog(Context context, String title, String msg, boolean cancelable)
  9. getInstallationDialog(final Context context)