List of usage examples for android.app AlertDialog show
public void show()
From source file:Main.java
/** * showInformationDialog/*from w w w .j a v a2 s . co 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
/** * showInformationDialog/*from www. jav a 2 s . c om*/ * * @param title * @param message * @param context * @param positiveListener * @param showNegativeOption */ public static void showInformationDialog(String title, String message, Context context, DialogInterface.OnClickListener positiveListener, boolean showNegativeOption) { AlertDialog.Builder alt_bld = new AlertDialog.Builder(context); alt_bld.setMessage(message); alt_bld.setCancelable(false); alt_bld.setPositiveButton("Aceptar", positiveListener); if (showNegativeOption) { alt_bld.setNegativeButton("Cancelar", 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(); }
From source file:Main.java
static public void ShowAlert(String title, String message) { tempTitle = title;//from www. jav 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:org.gc.networktester.util.Util.java
public static AlertDialog createDialog(final Activity activity, String message) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setMessage(message).setPositiveButton(activity.getString(R.string.dialog_ok), null); AlertDialog ad = builder.create(); ad.show(); return ad;// ww w . j a va 2 s.c om }
From source file:Main.java
/** * show an system default alert dialog with given title, msg, ok, cancal, listeners * * @param context// w w w. j a v a 2 s . c o m * @param title * @param msg * @param ok * @param lOk */ public static void showAlert(Context context, CharSequence title, CharSequence msg, CharSequence ok, DialogInterface.OnClickListener lOk) { AlertDialog dialog = buildAlert(context, title, msg, ok, null, lOk, null); if (dialog != null) { dialog.show(); } }
From source file:com.wellsandwhistles.android.redditsp.common.DialogUtils.java
public static void showSearchDialog(Context context, int titleRes, final OnSearchListener listener) { final AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context); final EditText editText = (EditText) LayoutInflater.from(context).inflate(R.layout.dialog_editbox, null); alertBuilder.setView(editText);//from ww w . ja va 2s . com alertBuilder.setTitle(titleRes); alertBuilder.setPositiveButton(R.string.action_search, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final String query = General.asciiLowercase(editText.getText().toString()).trim(); if (StringUtils.isEmpty(query)) { listener.onSearch(null); } else { listener.onSearch(query); } } }); alertBuilder.setNegativeButton(R.string.dialog_cancel, null); final AlertDialog alertDialog = alertBuilder.create(); alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); alertDialog.show(); }
From source file:Main.java
/** * show an system default alert dialog with given title, msg, ok, cancel, listeners * * @param context//from w ww .ja va 2 s . c o m * @param title * @param msg * @param ok * @param cancel * @param lOk * @param lCancel */ public static void showAlert(Context context, int title, int msg, int ok, int cancel, DialogInterface.OnClickListener lOk, DialogInterface.OnClickListener lCancel) { AlertDialog dialog = buildAlert(context, title, msg, ok, cancel, lOk, lCancel); if (dialog != null) { dialog.show(); } }
From source file:Main.java
/** * show an system default alert dialog with given title, msg, ok, cancal, listeners * * @param context/*from w w w. jav a 2 s . co m*/ * @param title * @param msg * @param ok * @param cancel * @param lOk * @param lCancel */ public static void showAlert(Context context, CharSequence title, CharSequence msg, CharSequence ok, CharSequence cancel, DialogInterface.OnClickListener lOk, DialogInterface.OnClickListener lCancel) { AlertDialog dialog = buildAlert(context, title, msg, ok, cancel, lOk, lCancel); if (dialog != null) { dialog.show(); } }
From source file:com.ecml.ChooseSongActivity.java
/** Show an error dialog with the given message */ public static void showErrorDialog(String message, Activity activity) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setMessage(message);/*w w w .j a v a 2 s . c o m*/ builder.setCancelable(false); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:Main.java
public static void showMessage(Context context, String title, String message, OnDismissListener listener) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); // set title/*from ww w .j a v a 2 s. com*/ alertDialogBuilder.setTitle(title); // set dialog message alertDialogBuilder.setMessage(message).setCancelable(true); // create alert dialog AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.setCanceledOnTouchOutside(true); if (listener != null) alertDialog.setOnDismissListener(listener); // show it alertDialog.show(); }