List of usage examples for android.app AlertDialog setMessage
public void setMessage(CharSequence message)
From source file:Main.java
public static AlertDialog showAlertMessage(String title, String message, Context context) { final AlertDialog alertDialog = new AlertDialog.Builder(context).create(); alertDialog.setTitle(title);//from w ww.ja va 2 s . c o m alertDialog.setMessage(message); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { alertDialog.dismiss(); } }); alertDialog.show(); return alertDialog; }
From source file:Main.java
public static void showMessage(String message, Context context) { AlertDialog alertDialog = new AlertDialog.Builder(context).create(); alertDialog.setTitle("New Message"); alertDialog.setMessage(message); alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss();/*from w w w .j a va 2s . c o m*/ } }); alertDialog.show(); }
From source file:Main.java
static public void showAlert(Context ctx, final String message) { AlertDialog alertDialog = new AlertDialog.Builder(ctx).create(); alertDialog.setTitle("Application Error"); alertDialog.setMessage(message); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "Dismiss", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Do nothing }//from w ww . j a va2s. c om }); alertDialog.show(); }
From source file:Main.java
static public void ShowAlert(String title, String message) { tempTitle = title;/*from ww w .j a v a 2 s . c o m*/ tempMessage = message; activity.runOnUiThread(new Runnable() { @Override public void run() { AlertDialog alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle(tempTitle); alertDialog.setMessage(tempMessage); alertDialog.show(); } }); }
From source file:Main.java
@SuppressWarnings("deprecation") public static void showAlert(final String title, final String msg, final Context context) { Activity a = (Activity) context;//from ww w . j a v a2 s .c o m a.runOnUiThread(new Runnable() { @Override public void run() { AlertDialog alertDialog = new AlertDialog.Builder(context).create(); alertDialog.setTitle(title); alertDialog.setMessage(msg); alertDialog.setButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { dialog.cancel(); } }); alertDialog.show(); } }); }
From source file:Main.java
public static void showMsgBox(Context c, String title, String msg) { AlertDialog ad = new AlertDialog.Builder(c).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage(msg); ad.setTitle(title);//w w w .j av a 2 s . c om ad.setButton(OK, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); ad.show(); }
From source file:Main.java
public static AlertDialog AlertDialogSingle(final Context context, String Title, String Message, String ButtonName) {/*from ww w . ja v a 2s .co m*/ AlertDialog alertDialog = new AlertDialog.Builder(context).create(); // Setting Dialog Title alertDialog.setTitle(Title); // Setting Dialog Message alertDialog.setMessage(Message); // Setting OK Button alertDialog.setButton(ButtonName, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Write your code here to execute after dialog closed Toast.makeText(context, "You clicked on OK", Toast.LENGTH_SHORT).show(); dialog.dismiss(); } }); // Showing Alert Message return alertDialog; }
From source file:com.crea_si.eviacam.wizard.WizardUtils.java
static void checkEngineAndFinishIfNeeded(final Activity a) { AccessibilityServiceModeEngine engine = MainEngine.getAccessibilityServiceModeEngine(); if (engine == null || !engine.isReady()) { // Engine is not ready anymore final Resources res = a.getResources(); AlertDialog ad = new AlertDialog.Builder(a).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setTitle(res.getText(R.string.eva_not_running)); ad.setMessage(res.getText(R.string.eva_not_running_summary)); ad.setButton(DialogInterface.BUTTON_NEUTRAL, res.getText(R.string.close), new DialogInterface.OnClickListener() { @Override/* ww w.j a va 2 s .com*/ public void onClick(DialogInterface dialog, int which) { finishWizard(a); } }); ad.show(); } }
From source file:org.rm3l.ddwrt.utils.Utils.java
@NotNull public static AlertDialog buildAlertDialog(@NotNull final Context context, @Nullable final String title, @NotNull final String msg, final boolean cancelable, final boolean cancelableOnTouchOutside) { @NotNull final AlertDialog alertDialog = new AlertDialog.Builder(context).create(); if (!Strings.isNullOrEmpty(title)) { alertDialog.setTitle(title);/* w w w . jav a 2s . co m*/ } alertDialog.setMessage(msg); alertDialog.setCancelable(cancelable); alertDialog.setCanceledOnTouchOutside(cancelableOnTouchOutside); return alertDialog; }
From source file:com.streaming.sweetplayer.utils.Utils.java
/** * Function to show a dialog to the user about a current problem or inform about something happening. * * @param context Context/*from www . j ava 2 s . com*/ * @param title String * @param message String */ public static void showAlertDialog(Context context, String title, String message) { AlertDialog alertDialog = new AlertDialog.Builder(context).create(); alertDialog.setTitle(title); alertDialog.setMessage(message); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); alertDialog.show(); }