List of usage examples for android.app AlertDialog.Builder create
public void create()
From source file:Main.java
public static AlertDialog createErrorDialog(final Activity activity, String title, String message, final boolean doFinish) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setMessage(message);//w w w . j a va 2 s . c o m builder.setTitle(title); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (doFinish) { activity.finish(); } } }); return builder.create(); }
From source file:Main.java
public static Dialog createMessageDialog(Activity activity, String message) { final CharSequence[] phoneQuit = { "OK" }; AlertDialog.Builder builder = new AlertDialog.Builder(activity).setIcon(android.R.attr.alertDialogStyle) .setTitle("Pay Attention Please !!!").setMessage(message) .setNeutralButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss();/*from w ww . ja v a 2s . c o m*/ } }); return builder.create(); }
From source file:Main.java
/** * showInformationDialog//w w w . j ava 2s . c o m * * @param title * @param message * @param context * @return */ public static AlertDialog showInformationDialog(String title, String message, Context context) { AlertDialog.Builder alt_bld = new AlertDialog.Builder(context); alt_bld.setMessage(message); alt_bld.setCancelable(false); alt_bld.setPositiveButton("Aceptar", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); AlertDialog alert = alt_bld.create(); // Title for AlertDialog alert.setTitle(title); alert.show(); return alert; }
From source file:Main.java
private static void showBackupDialog(final Context context, String message) { AlertDialog.Builder builder; AlertDialog alertDialog;/*from w ww. jav a2s . c o m*/ builder = new AlertDialog.Builder(context); builder.setMessage(message).setCancelable(true).setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); alertDialog = builder.create(); alertDialog.show(); }
From source file:Main.java
public static AlertDialog newMessageDialog(final Activity activity, String dialogTitle, String screenMessage, int iconResourceId) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setCancelable(false);/*from www . j a va 2 s .c o m*/ builder.setPositiveButton("Okay", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.setTitle(dialogTitle); builder.setMessage(screenMessage); builder.setIcon(iconResourceId); return builder.create(); }
From source file:Main.java
/** * Creates a new AlertDialog to display a simple message * // ww w . j a v a 2 s . c o m * @param context * @param dialogTitle * @param screenMessage * @param iconResourceId * @return */ public static AlertDialog newMessageDialog(final Context context, String dialogTitle, String screenMessage, int iconResourceId) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setCancelable(false); builder.setPositiveButton("Okay", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.setTitle(dialogTitle); builder.setMessage(screenMessage); builder.setIcon(iconResourceId); return builder.create(); }
From source file:Main.java
public static AlertDialog newMessageDialog(Context context, String s, String s1, int i) { android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context); builder.setCancelable(false);// w ww . j a va 2 s .c o m builder.setPositiveButton("Okay", new android.content.DialogInterface.OnClickListener() { public void onClick(DialogInterface dialoginterface, int j) { dialoginterface.dismiss(); } }); builder.setTitle(s); builder.setMessage(s1); builder.setIcon(i); return builder.create(); }
From source file:Main.java
/** * Generic error dialog with a close button. *//* www. ja va2s . c om*/ public static void showDialog(String title, String message, Context context) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); alertDialogBuilder.setTitle(title); alertDialogBuilder.setMessage(message).setCancelable(false).setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); }
From source file:net.naonedbus.utils.InfoDialogUtils.java
/** * Crer une dialog avec le titre et le contenu donn. * /*from w ww . ja v a2 s . co m*/ * @param context * @param titleId * @param messageId * @return La dialogue. */ public static AlertDialog getDialog(final Context context, final int titleId, final int messageId) { final AlertDialog.Builder moreDetailsDialog = new AlertDialog.Builder(context); moreDetailsDialog.setTitle(context.getString(titleId)); moreDetailsDialog.setMessage(context.getString(messageId)); moreDetailsDialog.setPositiveButton(android.R.string.ok, null); return moreDetailsDialog.create(); }
From source file:io.trigger.forge.android.modules.contextmenu.API.java
public static void show(final ForgeTask task, @ForgeParam("items") final JsonArray JSONItems) throws JSONException { final AlertDialog.Builder builder = new AlertDialog.Builder( new ContextThemeWrapper(ForgeApp.getActivity(), android.R.style.Theme_Holo)); final String[] items = toJavaArray(JSONItems); builder.setItems(items, new OnClickListener() { @Override/*www . ja v a 2s . c o m*/ public void onClick(DialogInterface dialog, int which) { task.success(items[which]); } }); AlertDialog toShow = builder.create(); toShow.show(); }