List of usage examples for android.app AlertDialog.Builder setMessage
public void setMessage(CharSequence message)
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 ww .j a v a 2 s.com builderDialog.setMessage(msg); builderDialog.setNeutralButton("Ok", null); builderDialog.setIcon(icone); builderDialog.show(); }
From source file:Main.java
public static void mostrarCaixaDialogoSimples(Context context, String titulo, String mensagem) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(titulo);//w w w . ja v a 2 s. c om builder.setMessage(mensagem); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); AlertDialog alertDialog = builder.create(); alertDialog.show(); }
From source file:Main.java
/** * //from w w w . j a v a2 s.co m * Return an Alert Dialog with two buttons and a title. * @param context - The Activity which needs this alert dialog. * @param message - The message in the alert. * @param positiveBtnLabel - The label of the positive button. * @param negetiveBtnLabel - The label of the negative button. * @param positiveClickListener- The onClickListener of the positive button. * @param negativeClickListener- The onClickListener of the negative button. * @param input - Edit text input. * @return - The generated Alert Dialog. */ public static AlertDialog.Builder getAlertDialogWithTwoButtonAndEditView(Context context, String message, String positiveBtnLabel, String negetiveBtnLabel, DialogInterface.OnClickListener positiveClickListener, DialogInterface.OnClickListener negativeClickListener, EditText input) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener) .setNegativeButton(negetiveBtnLabel, negativeClickListener); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); input.setLayoutParams(params); builder.setView(input); return builder; }
From source file:Main.java
public static void DisplayAlertOKCancel(final Context context, final String title, final String message) { retValue = -1;//from w ww . j av a2s .c o m final Activity activity = (Activity) context; activity.runOnUiThread(new Runnable() { @Override public void run() { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(message); builder.setTitle(title); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { retValue = 1; alert = null; } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { retValue = 0; alert = null; } }); alert = builder.create(); alert.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);/* ww w . j a va2s . co m*/ builder.setMessage(message); 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
/** * Show a confirm/cancel dialog./*from w ww . j ava2 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
/** * General Purpose AlertDialog*//*from w w w .ja va2 s.co m*/ 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*//*from ww w.ja v a2s .com*/ 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 createAlert(String errorTitle, String errorMessage, Context ctx) { AlertDialog.Builder dialog = new AlertDialog.Builder(ctx); dialog.setTitle(errorTitle);/*from w ww . j a va 2 s . co m*/ dialog.setMessage(errorMessage); dialog.setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { return; } }); dialog.show(); }
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 av a 2 s.com*/ */ 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; }