List of usage examples for android.app AlertDialog.Builder setMessage
public void setMessage(CharSequence message)
From source file:Main.java
public static void showAlertDialog(Context context, String title, String message, int iconId, String textButton) {/* w w w . j av a2 s .com*/ AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(message); builder.setCancelable(false); if (iconId > 0) builder.setIcon(iconId); builder.setNegativeButton(textButton, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:Main.java
public static void showDialog(Activity context, String strTitle, String strText, String BtnEnsure) { AlertDialog.Builder tDialog = new AlertDialog.Builder(context); // tDialog.setIcon(icon); tDialog.setTitle(strTitle);/* w ww . j av a2 s . com*/ tDialog.setMessage(strText); tDialog.setPositiveButton(BtnEnsure, null); tDialog.show(); }
From source file:Main.java
/**To display alert dialog * @author wajdihh// w w w . j a v a2s . c om * 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 openAbout(Activity a) { Log.d("about", "openAbout has been called"); //Log.d("context", "context = "+ c.toString()); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(a); alertDialogBuilder.setTitle("About"); alertDialogBuilder.setMessage( "This app was developed for CS160 at UC Berkeley by:\n\nDominic Kong \nPatrick Lin \nMeghana Seshadri \nJane Sima") .setCancelable(true).setNeutralButton("Close", new DialogInterface.OnClickListener() { @Override//from w w w .ja va 2 s. c o m public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); }
From source file:Main.java
private static void showBackupDialog(final Context context, String message) { AlertDialog.Builder builder; AlertDialog alertDialog;//from w ww . j a v a 2 s . 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
private static AlertDialog showDownloadDialog(final Activity activity, CharSequence stringTitle, CharSequence stringMessage, CharSequence stringButtonYes, CharSequence stringButtonNo) { AlertDialog.Builder downloadDialog = new AlertDialog.Builder(activity); downloadDialog.setTitle(stringTitle); downloadDialog.setMessage(stringMessage); downloadDialog.setPositiveButton(stringButtonYes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { Uri uri = Uri.parse("market://search?q=pname:org.torproject.android"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); activity.startActivity(intent); }/*from ww w . j a v a 2 s . c om*/ }); downloadDialog.setNegativeButton(stringButtonNo, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { } }); return downloadDialog.show(); }
From source file:Main.java
public static AlertDialog genericOneButtonAlert(Context mContext, String title, String msg, String button) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mContext); alertDialogBuilder.setTitle(title);/*from www. j a v a 2 s . c om*/ alertDialogBuilder.setMessage(msg).setCancelable(true).setPositiveButton(button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); //finish(); } }); // create alert dialog AlertDialog alertDialog = alertDialogBuilder.create(); // show it return alertDialog; }
From source file:Main.java
private static AlertDialog showDownloadDialog(final Activity activity, CharSequence stringTitle, CharSequence stringMessage, CharSequence stringButtonYes, CharSequence stringButtonNo, final String uriString) { AlertDialog.Builder downloadDialog = new AlertDialog.Builder(activity); downloadDialog.setTitle(stringTitle); downloadDialog.setMessage(stringMessage); downloadDialog.setPositiveButton(stringButtonYes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { Uri uri = Uri.parse(uriString); Intent intent = new Intent(Intent.ACTION_VIEW, uri); activity.startActivity(intent); }//from w w w. ja v a 2 s. co m }); downloadDialog.setNegativeButton(stringButtonNo, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { } }); return downloadDialog.show(); }
From source file:Main.java
private static AlertDialog buildErrorDialog(final Activity context, String title, String description, String buttonText) {/*www.j a v a2 s . c om*/ AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setMessage(description); builder.setCancelable(false); builder.setPositiveButton(buttonText, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, int which) { new Handler().post(new Runnable() { @Override public void run() { dialog.dismiss(); context.finish(); } }); } }); return builder.create(); }
From source file:Main.java
/** * showInformationDialog/*from w w w. ja v a2s.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; }