List of usage examples for android.app AlertDialog.Builder create
public void create()
From source file:com.librelio.activity.MainMagazineActivity.java
private Dialog createDialog(int titleId, int messageId) { String helpUrl = replaceLanguageAndRegion(getString(R.string.help_url)); final Uri helpUri = Uri.parse(helpUrl); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(titleId).setIcon(android.R.drawable.stat_sys_warning).setMessage(messageId) .setCancelable(false).setPositiveButton(android.R.string.ok, null) .setNegativeButton(R.string.learn_more, new DialogInterface.OnClickListener() { @Override//from ww w .j a v a2 s . c o m public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Intent.ACTION_VIEW, helpUri); startActivity(intent); } }); return builder.create(); }
From source file:edu.missouri.niaaa.ema.activity.AdminManageActivity.java
private Dialog assignFailDialog(Context context, String str) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setCancelable(false);/*w w w . jav a 2s. co m*/ builder.setTitle(R.string.assign_confirm_title); builder.setMessage(str); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { setHints(); } }); return builder.create(); }
From source file:com.xargsgrep.portknocker.activity.EditHostActivity.java
private void showCancelDialog() { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setTitle(R.string.confirm_dialog_cancel_edit_title); dialogBuilder.setIcon(R.drawable.ic_dialog_confirm); dialogBuilder.setPositiveButton(R.string.confirm_dialog_confirm, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { returnToHostListActivity(null); }//from w ww . j a va 2 s . com }); dialogBuilder.setNegativeButton(R.string.confirm_dialog_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); cancelDialog = dialogBuilder.create(); cancelDialog.show(); }
From source file:com.rainmakerlabs.bleepsample.BleepService.java
private void showAlertDialog(String title, String msg, String posText, DialogInterface.OnClickListener posFunc, String negText, DialogInterface.OnClickListener negFunc, EditText input) { if (BLEalert != null && BLEalert.isShowing()) { BLEalert.cancel();// ww w .jav a 2s.c om } //if (BLEalert == null || !BLEalert.isShowing()) { if (title == null) title = ""; if (msg == null) msg = ""; if (title.equalsIgnoreCase("") && msg.equalsIgnoreCase("")) return; AlertDialog.Builder builder = new AlertDialog.Builder(BleepActivity.currentBleepActivity); builder.setTitle(title); builder.setMessage(msg); if (input != null) builder.setView(input); if (posText != null && !posText.equalsIgnoreCase("")) builder.setPositiveButton(posText, posFunc); if (negText != null && !negText.equalsIgnoreCase("")) builder.setNegativeButton(negText, negFunc); BLEalert = builder.create(); BLEalert.show(); //} }
From source file:com.zapto.park.ParkActivity.java
public AlertDialog makeAlertDialog(String title, String message) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(title)//from www. j a v a 2 s. c om //.setIcon(android.R.drawable.stat_sys_warning) .setMessage(message).setCancelable(true).setPositiveButton(android.R.string.ok, null); /*.setNegativeButton(R.string.learn_more, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Intent.ACTION_VIEW, helpUri); startActivity(intent); } });*/ return builder.create(); }
From source file:com.miuidev.themebrowser.MainActivity.java
private void displayAbout() { AlertDialog.Builder builder; AlertDialog alertDialog;//from w w w.java 2 s . c o m LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.dialog_about, (ViewGroup) findViewById(R.id.DialogAboutRelativeLayout)); TextView text = (TextView) layout.findViewById(R.id.AboutVersionValue); text.setText(getVersionName()); builder = new AlertDialog.Builder(this); builder.setView(layout); builder.setCancelable(false).setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); alertDialog = builder.create(); alertDialog.show(); }
From source file:de.unclenet.dehabewe.CalendarActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_ACCOUNTS: AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Select a Google account"); final AccountManager manager = AccountManager.get(this); final Account[] accounts = manager.getAccountsByType("com.google"); final int size = accounts.length; String[] names = new String[size]; for (int i = 0; i < size; i++) { names[i] = accounts[i].name; }/*from ww w. jav a2 s .c o m*/ builder.setItems(names, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { gotAccount(manager, accounts[which]); } }); return builder.create(); } return null; }
From source file:com.df.push.DemoActivity.java
private void displayOptionsToSubscribe() { final CharSequence[] cs = topics.toArray(new CharSequence[topics.size()]); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Select topic to subscribe"); builder.setItems(cs, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { // Do something with the selection final SharedPreferences prefs = getGcmPreferences(context); subscribe(cs[item].toString(), prefs.getString(PROPERTY_REG_URL, null)); }/* ww w . ja va2 s . c om*/ }); AlertDialog alert = builder.create(); alert.show(); }
From source file:de.thecamper.android.androidtools.UpdateChecker.java
/** * show a AlertDialog to inform the user of the update and let him download * the new version of the app// w w w . ja v a 2s . c om */ public void showUpdateAlert() { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(context.getString(R.string.updateTitle)); builder.setMessage(context.getString(R.string.updateAvailable)); builder.setCancelable(false); builder.setPositiveButton(context.getString(R.string.yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(appURL)); context.startActivity(intent); ((Activity) context).finish(); } }); builder.setNegativeButton(context.getString(R.string.later), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); }