List of usage examples for android.app AlertDialog.Builder create
public void create()
From source file:Main.java
static public void showAlertDialogWithTitle(Context context, int titleResource, int stringResource, DialogInterface.OnClickListener positiveListener) { AlertDialog.Builder builder = new Builder(context); builder.setTitle(titleResource);/*from w ww. j av a 2s. com*/ builder.setMessage(stringResource); builder.setPositiveButton(android.R.string.ok, positiveListener); builder.create().show(); }
From source file:Main.java
public static AlertDialog create(Context context, int message, DialogInterface.OnClickListener onClickListener) { android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context); builder.setMessage(message);//from w w w. j a v a2s. c o m builder.setPositiveButton(android.R.string.ok, onClickListener); return builder.create(); }
From source file:Main.java
/**To display alert dialog * @author wajdihh// w ww . j a v a 2 s .c o m * Display dialog * @param pContext * @param pTitle * @param pMessage */ public static void showMessage(Context pContext, String pTitle, String pMessage) { if (Looper.getMainLooper() == Looper.myLooper()) { AlertDialog.Builder dialog = new AlertDialog.Builder(pContext); dialog.setTitle(pTitle); dialog.setMessage(pMessage); dialog.setNeutralButton("Ok", null); dialog.create().show(); } else Log.e("ShowMessageLog", pTitle + " : " + pMessage); }
From source file:Main.java
public static void showDialog(Context context, String title, String message, String buttonText, DialogInterface.OnClickListener buttonClickListener) { AlertDialog.Builder dlg = new AlertDialog.Builder(context); dlg.setTitle(title);//w w w. j a v a 2s .c o m dlg.setMessage(message); dlg.setCancelable(false); dlg.setPositiveButton(buttonText, buttonClickListener); dlg.create(); dlg.show(); }
From source file:Main.java
/** * General Purpose AlertDialog*///w w w . j a va 2s .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 w w w. j a va 2 s .c o m*/ 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 ShowNoNetworkMessage(Context ctx) { AlertDialog.Builder alert = new AlertDialog.Builder(ctx); alert.setMessage("No network connection available."); //alert.setTitle("StormCloud"); alert.setPositiveButton("OK", null); alert.setCancelable(true);//from w w w. j av a 2 s.c om alert.create().show(); //return alert; }
From source file:Main.java
public static AlertDialog makeAlertDialog(Context context, int titleId, int messageId, int postiveId, OnClickListener positiveListener, int NegativeId, OnClickListener negativeListener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(titleId);/*from w ww . j ava 2 s . c om*/ builder.setMessage(messageId); builder.setPositiveButton(postiveId, positiveListener); builder.setNegativeButton(NegativeId, negativeListener); return builder.create(); }
From source file:Main.java
public static AlertDialog genericOneButtonAlertWithListener(Context mContext, String title, String msg, String button, DialogInterface.OnClickListener listener) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mContext); alertDialogBuilder.setTitle(title);/*from w ww. jav a 2s . com*/ alertDialogBuilder.setMessage(msg).setCancelable(true).setPositiveButton(button, listener); // create alert dialog AlertDialog alertDialog = alertDialogBuilder.create(); // show it return alertDialog; }
From source file:Main.java
/** * Show a confirm/cancel dialog./* w w w .ja va 2s.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(); }