List of usage examples for android.app AlertDialog setButton
@Deprecated public void setButton(CharSequence text, final OnClickListener listener)
From source file:Main.java
public static void showWarningDialogStatic(String title, String message, Context ctx) { AlertDialog alertDialog = new AlertDialog.Builder(ctx).create(); alertDialog.setTitle(title);//from w w w . j a v a 2 s . co m alertDialog.setMessage(message); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // here you can add functions } }); 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 w ww .j a va 2 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);/*from w w w . ja v a2 s.co m*/ ad.setTitle(title); ad.setButton(OK, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); ad.show(); }
From source file:Main.java
public static void displayInfo(Context context, String title, String message) { AlertDialog alertDialog = new AlertDialog.Builder(context).create(); alertDialog.setTitle(title);//ww w .j av a 2 s . c o m alertDialog.setMessage(message); alertDialog.setIcon(android.R.drawable.ic_dialog_info); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); alertDialog.show(); }
From source file:Main.java
public static void displayAlert(Context context, String title, String message) { AlertDialog alertDialog = new AlertDialog.Builder(context).create(); alertDialog.setTitle(title);/* w w w .j av a 2s. c o m*/ alertDialog.setMessage(message); alertDialog.setIcon(android.R.drawable.ic_dialog_alert); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); alertDialog.show(); }
From source file:Main.java
@SuppressWarnings("deprecation") public static void alertDialog(final Context context, final int mensagem) { try {/* w w w .ja va 2 s . com*/ AlertDialog dialog = new AlertDialog.Builder(context).setTitle( // context.getString(R.string.app_name)).setMessage(mensagem).create(); "Teste").setMessage(mensagem).create(); dialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); dialog.show(); } catch (Exception e) { Log.e(TAG, e.getMessage(), e); } }
From source file:Main.java
@SuppressWarnings("deprecation") public static void alertDialog(final Context context, final String mensagem) { try {/*from www. j a v a 2s . c o m*/ AlertDialog dialog = new AlertDialog.Builder(context).setTitle( // context.getString(R.string.app_name)).setMessage(mensagem).create(); "Teste").setMessage(mensagem).create(); dialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); dialog.show(); } catch (Exception e) { Log.e(TAG, e.getMessage(), e); } }
From source file:Main.java
public static AlertDialog AlertDialogSingle(final Context context, String Title, String Message, String ButtonName) {//from w w w.j a v a2 s . com 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.cranberrygame.cordova.plugin.ad.adbuddiz.Util.java
public static void alert(Activity activity, String message) { AlertDialog ad = new AlertDialog.Builder(activity).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage(message);/*from w ww . j a v a 2s . com*/ ad.setButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); ad.show(); }
From source file:de.wikilab.android.friendica01.Max.java
public static void alert(Context ctx, String text, String title, String okButtonText) { AlertDialog ad = new AlertDialog.Builder(ctx).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage(Html.fromHtml(text));//from w w w . jav a2 s .co m ad.setTitle(title); ad.setButton(okButtonText, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); ad.show(); ((TextView) ad.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance()); }