List of usage examples for android.app AlertDialog.Builder setTitle
@Override public void setTitle(CharSequence title)
From source file:Main.java
/** * Show a confirm/cancel dialog.//from w w w . j a v a 2 s .com * @param context The context to use. Usually your {@link Application} or {@link Activity} object. * @param titleId Resource id for the title string. * @param messageId Resource id for the message string. * @param yesId Resource id for the confirm button message string. * @param yesListener Listener for the confirm action. * @param noId Resource id for the cancel button message string. * @param noListener Listener for the cancel action. */ public static void showDialog(Context context, int titleId, int messageId, int yesId, DialogInterface.OnClickListener yesListener, int noId, DialogInterface.OnClickListener noListener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(titleId); builder.setMessage(messageId); builder.setCancelable(false); builder.setPositiveButton(yesId, yesListener); builder.setNegativeButton(noId, noListener); builder.create().show(); }
From source file:Main.java
public static void createCancellableAcceptDialog(Context context, String title, String message, String acceptButtonText, final Runnable onAccept) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(message);/*w w w . j a va2s . c om*/ builder.setInverseBackgroundForced(true); builder.setPositiveButton(acceptButtonText, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); if (onAccept != null) onAccept.run(); } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:Main.java
public static void showDialogBox(Context context, String title, String msg, int icon) { AlertDialog.Builder ad = new AlertDialog.Builder(context); ad.setTitle(title); ad.setPositiveButton(android.R.string.ok, null); if (icon <= 0) ad.setIcon(android.R.drawable.ic_dialog_alert); else//www . j a v a 2 s.c o m ad.setIcon(icon); ad.setMessage(msg); ad.show(); }
From source file:Main.java
public static void createAlert(String errorTitle, String errorMessage, Context ctx) { AlertDialog.Builder dialog = new AlertDialog.Builder(ctx); dialog.setTitle(errorTitle); dialog.setMessage(errorMessage);//from www . j a va2 s . c o m dialog.setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { return; } }); dialog.show(); }
From source file:Main.java
/** * General Purpose AlertDialog*///ww w. j a v a 2 s . c om public static AlertDialog showMessageAlertDialog(Context context, String message, String title, DialogInterface.OnClickListener listener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(message); builder.setPositiveButton(android.R.string.ok, listener); AlertDialog dialog = builder.create(); dialog.show(); return dialog; }
From source file:Main.java
/** * General Purpose AlertDialog*/// w ww. j a v a 2s. c o m public static AlertDialog showMessageAlertDialog(Context context, int message, int title, DialogInterface.OnClickListener listener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(message); builder.setPositiveButton(android.R.string.ok, listener); AlertDialog dialog = builder.create(); dialog.show(); return dialog; }
From source file:Main.java
public static void showMessage(Context _context, String title, String message, int icon, DialogInterface.OnClickListener ackHandler) { try {/*from ww w. ja v a 2 s. c o m*/ 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 AlertDialog genericOneButtonAlertWithListener(Context mContext, String title, String msg, String button, DialogInterface.OnClickListener listener) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mContext); alertDialogBuilder.setTitle(title); alertDialogBuilder.setMessage(msg).setCancelable(true).setPositiveButton(button, listener); // create alert dialog AlertDialog alertDialog = alertDialogBuilder.create(); // show it/* w w w. j a va 2 s .c om*/ return alertDialog; }
From source file:Main.java
/** * Return an Alert Dialog Single choice list and a title. * * @param context - The Activity which needs this alert dialog. * @param title - The message title the alert. * @param items - List of items should show in the choice list * @param onClickListener - The onClickListener of choice item. * @return - The generated Alert Dialog. *///from w ww .j a va 2 s . co m public static AlertDialog.Builder getAlertDialogWithSingleChoices(Context context, String title, String[] items, DialogInterface.OnClickListener onClickListener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setSingleChoiceItems(items, -1, onClickListener); return builder; }
From source file:Main.java
/** * Returns an Alert Dialog with OK button and title. * @param context -The activity which need this alert. * @param title -The alert title. * @param message -The alert message. * @param neutralBtnLabel -The Neutral button label. * @param neutralClickListener -The neutral button listener. * @return - An alert dialog.//from w w w . j a va 2 s .c o m */ public static AlertDialog.Builder getAlertDialogWithNeutralButtonAndTitle(Context context, String title, String message, String neutralBtnLabel, DialogInterface.OnClickListener neutralClickListener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(message).setNeutralButton(neutralBtnLabel, neutralClickListener); return builder; }