List of usage examples for android.app AlertDialog.Builder setMessage
public void setMessage(CharSequence message)
From source file:palamarchuk.smartlife.app.RegisterActivity.java
public static void alert(Context context, String message) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(message); builder.setTitle(""); builder.setPositiveButton("Ok", null); builder.show();//from ww w.ja v a 2s . c o m }
From source file:mp.paschalis.App.java
/** * Finds out if network connection is available *///w w w. j a v a 2s. c o m public static void isNetworkAvailable(final Context ctx) { ConnectivityManager connectivityManager = (ConnectivityManager) ctx .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); if (activeNetworkInfo == null) { { AlertDialog.Builder alert = new AlertDialog.Builder(ctx); alert.setTitle(R.string.msgNoInternetConnectionTitle); alert.setMessage(R.string.msgNoInternetConnection); alert.setIcon(android.R.drawable.ic_dialog_alert); alert.setNeutralButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { ctx.startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS)); } }); alert.show(); } } }
From source file:edu.mit.mobile.android.locast.accounts.AuthenticatorActivity.java
public static Dialog createLogoutDialog(Context context, LogoutHandler onLogoutHandler) { final AlertDialog.Builder b = new AlertDialog.Builder(context); final String appName = context.getString(R.string.app_name); b.setTitle(context.getString(R.string.auth_logout_title, appName)); b.setMessage(context.getString(R.string.auth_logout_message, appName)); b.setCancelable(true);//from w ww.j a v a 2 s . co m b.setPositiveButton(R.string.auth_logout, onLogoutHandler); b.setNegativeButton(android.R.string.cancel, null); return b.create(); }
From source file:edu.mit.mobile.android.locast.accounts.AbsLocastAuthenticatorActivity.java
/** * Given a logout handler and information about the app, create a standard logout dialog box * that prompts the user if they want to logout. * * @param context/* w w w .j a v a2s. c o m*/ * @param appName * the name of your app. This is integrated into the text using the * {@code auth_logout_title} and {@code auth_logout_message} string resources. * @param onLogoutHandler * @return */ public static Dialog createLogoutDialog(Context context, CharSequence appName, LogoutHandler onLogoutHandler) { final AlertDialog.Builder b = new AlertDialog.Builder(context); b.setTitle(context.getString(R.string.auth_logout_title, appName)); b.setMessage(context.getString(R.string.auth_logout_message, appName)); b.setCancelable(true); b.setPositiveButton(R.string.auth_logout, onLogoutHandler); b.setNegativeButton(android.R.string.cancel, null); return b.create(); }
From source file:it.mb.whatshare.Dialogs.java
/** * Shows a dialog informing the user that no outbound device is currently * configured, and takes the user to the {@link PairOutboundActivity}. * //from w w w. j av a 2s . co m * @param activity * the caller activity */ public static void noPairedDevice(final FragmentActivity activity) { new PatchedDialogFragment() { public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = getNoUiBuilder(activity); builder.setMessage(getString(R.string.no_paired_device)); builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent i = new Intent(activity, PairOutboundActivity.class); startActivity(i); } }); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(false); return dialog; } }.show(activity.getSupportFragmentManager(), "no paired device"); }
From source file:it.mb.whatshare.Dialogs.java
/** * Shows a dialog that informs the user of the result of a pairing action, * and saves the newly paired outbound device if the operation was * successful.// w w w . j a v a 2s . com * * <p> * Once the user taps on the OK button, * {@link Activity#startActivity(Intent)} is called to get back to the * {@link MainActivity}. * * @param device * the outbound device to be paired * @param activity * the caller activity */ public static void onPairingOutbound(final PairedDevice device, final FragmentActivity activity) { new PatchedDialogFragment() { public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = getBuilder(activity); try { builder.setMessage(getString(R.string.failed_pairing)); if (device != null) { PairOutboundActivity.savePairing(device, activity); builder.setMessage(getResources().getString(R.string.successful_pairing, device.type)); } } catch (IOException e) { // TODO let user know e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // back to main screen startActivity(new Intent(activity, MainActivity.class)); } }); return builder.create(); } }.show(activity.getSupportFragmentManager(), "code"); }
From source file:com.pdftron.pdf.utils.Utils.java
public static AlertDialog.Builder getAlertDialogBuilder(Context context, String message, String title) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(message).setCancelable(true); if (!isNullOrEmpty(title)) { builder.setTitle(title);// w w w . j av a 2 s . c om } return builder; }
From source file:com.pdftron.pdf.utils.Utils.java
public static void showAlertDialogWithLink(Context context, String message, String title) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(Html.fromHtml(message)).setCancelable(true).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override/*w ww . ja va 2s. c o m*/ public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); if (title.length() > 0) { builder.setTitle(title); } final AlertDialog d = builder.create(); d.show(); // Make the textview clickable. Must be called after show() ((TextView) d.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:org.geek.utils.ApplicationUtils.java
/** * Display a continue / cancel dialog./*from w w w. java 2 s. c o m*/ * @param context The current context. * @param icon The dialog icon. * @param title The dialog title. * @param message The dialog message. * @param onContinue The dialog listener for the continue button. * @param onCancel The dialog listener for the cancel button. */ public static void showContinueCancelDialog(Context context, int icon, String title, String message, DialogInterface.OnClickListener onContinue, DialogInterface.OnClickListener onCancel) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setCancelable(true); builder.setIcon(icon); builder.setTitle(title); builder.setMessage(message); builder.setInverseBackgroundForced(true); builder.setPositiveButton(context.getResources().getString(R.string.Commons_Continue), onContinue); builder.setNegativeButton(context.getResources().getString(R.string.Commons_Cancel), onCancel); AlertDialog alert = builder.create(); alert.show(); }
From source file:org.geek.utils.ApplicationUtils.java
/** * Display a standard Ok dialog./* w w w . ja va 2 s.co m*/ * @param context The current context. * @param icon The dialog icon. * @param title The dialog title. * @param message The dialog message. */ public static void showOkDialog(Context context, int icon, String title, String message) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setCancelable(false); builder.setIcon(icon); builder.setTitle(title); builder.setMessage(message); builder.setInverseBackgroundForced(true); builder.setPositiveButton(context.getResources().getString(R.string.Commons_Ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alert = builder.create(); alert.show(); }