Example usage for android.app AlertDialog.Builder setIcon

List of usage examples for android.app AlertDialog.Builder setIcon

Introduction

In this page you can find the example usage for android.app AlertDialog.Builder setIcon.

Prototype

public void setIcon(Drawable icon) 

Source Link

Usage

From source file:Main.java

public static void addMsgOk(Activity activity, String titulo, String msg, int icone) {
    AlertDialog.Builder builderDialog = new AlertDialog.Builder(activity);
    builderDialog.setTitle(titulo);/*  w w w .j  a v  a  2  s .  c o  m*/
    builderDialog.setMessage(msg);
    builderDialog.setNeutralButton("Ok", null);
    builderDialog.setIcon(icone);
    builderDialog.show();
}

From source file:Main.java

public static void showAlertDialog(Context context, String title, String message, int iconId,
        String textButton) {//from  w  ww .j ava2s  .c  o  m

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(title);
    builder.setMessage(message);
    builder.setCancelable(false);
    if (iconId > 0)
        builder.setIcon(iconId);

    builder.setNegativeButton(textButton, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });

    AlertDialog alert = builder.create();
    alert.show();
}

From source file:Main.java

public static void showMessage(Context _context, String title, String message, int icon,
        DialogInterface.OnClickListener ackHandler) {
    AlertDialog.Builder builder = new AlertDialog.Builder(_context);
    builder.setTitle(title);/*from w w w.  j  a v a 2  s  . c  o m*/
    builder.setMessage(Html.fromHtml(message));
    builder.setCancelable(false);
    builder.setPositiveButton("Acknowledged", ackHandler);
    builder.setIcon(icon);
    builder.show();
}

From source file:Main.java

public static void showMessage(Context _context, String title, String message, int icon,
        DialogInterface.OnClickListener ackHandler) {
    try {/* w ww.  ja v  a2s.  c om*/
        AlertDialog.Builder builder = new AlertDialog.Builder(_context);
        builder.setTitle(title);
        builder.setMessage(Html.fromHtml(message));
        builder.setCancelable(false);
        builder.setPositiveButton("Acknowledged", ackHandler);
        builder.setIcon(icon);
        builder.show();
    } catch (Exception e) {
    }
}

From source file:Main.java

public static void showMessage(Context _context, String title, String message, int icon,
        DialogInterface.OnClickListener ackHandler) {
    AlertDialog.Builder builder = new AlertDialog.Builder(_context);
    builder.setTitle(title);//from ww w  .  j  a v a  2  s. c o  m
    builder.setMessage(Html.fromHtml(message));
    builder.setCancelable(false);
    builder.setPositiveButton("Acknowledged", ackHandler);
    builder.setIcon(icon);
    boolean show = true;
    if (_context instanceof Activity) {
        Activity activity = (Activity) _context;
        if (activity.isFinishing()) {
            show = false;
        }
    }
    if (show)
        builder.show();
}

From source file:Main.java

public static AlertDialog newYesNoDialog(Context context, String s, String s1, int i,
        android.content.DialogInterface.OnClickListener onclicklistener) {
    android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context);
    builder.setCancelable(false);//w w  w. ja v a2s. c  o m
    builder.setPositiveButton(0x1040013, onclicklistener);
    builder.setNegativeButton(0x1040009, onclicklistener);
    builder.setTitle(s);
    builder.setMessage(s1);
    builder.setIcon(i);
    return builder.create();
}

From source file:com.ccs.wedate.common.eventbus.util.ErrorDialogFragments.java

public static Dialog createDialog(Context context, Bundle arguments, OnClickListener onClickListener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(arguments.getString(ErrorDialogManager.KEY_TITLE));
    builder.setMessage(arguments.getString(ErrorDialogManager.KEY_MESSAGE));
    if (ERROR_DIALOG_ICON != 0) {
        builder.setIcon(ERROR_DIALOG_ICON);
    }/*  w  w w. j a v  a  2  s.  c  o m*/
    builder.setPositiveButton(android.R.string.ok, onClickListener);
    return builder.create();
}

From source file:Main.java

public static AlertDialog newYesNoDialog(final Activity activity, String dialogTitle, String screenMessage,
        int iconResourceId, OnClickListener listener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setCancelable(false);//  www. j  a  v a 2 s .  com
    builder.setPositiveButton(android.R.string.yes, listener);
    builder.setNegativeButton(android.R.string.no, listener);

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

    return builder.create();
}

From source file:Main.java

/**
 * Creates a new Yes/No AlertDialog/*from w ww.  jav  a  2s . c om*/
 * 
 * @param context
 * @param dialogTitle
 * @param screenMessage
 * @param iconResourceId
 * @param listener
 * @return
 */
public static AlertDialog newYesNoDialog(final Context context, String dialogTitle, String screenMessage,
        int iconResourceId, OnClickListener listener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(false);
    builder.setPositiveButton(android.R.string.yes, listener);
    builder.setNegativeButton(android.R.string.no, listener);

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

    return builder.create();
}

From source file:com.jamesgiang.aussnowcam.Utils.java

public static void About(Context c) {
    AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(c);
    dialogBuilder.setTitle(R.string.app_name);
    dialogBuilder.setIcon(R.drawable.icon);
    TextView textView = new TextView(c);
    SpannableString s = new SpannableString(c.getString(R.string.about_info));
    Linkify.addLinks(s, Linkify.WEB_URLS);
    textView.setText(s);/*w  w  w .  j av  a  2 s .  c  o  m*/
    textView.setGravity(Gravity.CENTER);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    dialogBuilder.setView(textView);
    dialogBuilder.show();
}