List of usage examples for android.app AlertDialog.Builder setTitle
@Override public void setTitle(CharSequence title)
From source file:net.reichholf.dreamdroid.activities.TimerListActivity.java
/** * Confirmation dialog before timer deletion */// w w w .j a v a 2 s.c o m private void deleteTimerConfirm() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(mTimer.getString(Timer.NAME)).setMessage(getText(R.string.delete_confirm)) .setCancelable(false) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { deleteTimer(mTimer); dialog.dismiss(); } }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:com.dev.pygmy.game.GameHomePageActivity.java
private void onReportClick() { final ArrayList<String> selectedItems = new ArrayList<String>(); final String[] reasons = getResources().getStringArray(R.array.report_reasons); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Report: " + ((TextView) findViewById(R.id.name_game)).getText()); builder.setMultiChoiceItems(reasons, null, new DialogInterface.OnMultiChoiceClickListener() { @Override// w ww. ja va 2 s . c om public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) { String reason = reasons[indexSelected]; if (isChecked) { selectedItems.add(reason); } else if (selectedItems.contains(reason)) { selectedItems.remove(reason); } Button positiveButton = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE); positiveButton.setEnabled((selectedItems.size() != 0)); } }) // Assign action buttons .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { new GameReportTask(GameHomePageActivity.this, selectedItems).execute(mGame.name); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { Toast.makeText(GameHomePageActivity.this, "Report canceled", Toast.LENGTH_SHORT).show(); } }); reportDialog = builder.create(); reportDialog.show(); reportDialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(false); }
From source file:ar.uba.fi.mileem.SimpleFormActivity.java
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_legalnotices: String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext()); AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(SimpleFormActivity.this); LicenseDialog.setTitle("Legal Notices"); LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show();//from w w w . ja va 2s . co m return true; } return super.onOptionsItemSelected(item); }
From source file:com.jdom.get.stuff.done.android.AndroidApplicationContextFactory.java
public void getTextInputForAction(String title, String hintText, String doButtonText, String dontButtonText, final RunnableWithResults<String> callback) { final EditText textView = new EditText(activity); textView.setHint(hintText);//ww w . j a va2s. co m AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setView(textView); builder.setTitle(title); builder.setCancelable(false).setPositiveButton(doButtonText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { callback.callback(textView.getText().toString()); } }).setNegativeButton(dontButtonText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); builder.show(); }
From source file:net.kourlas.voipms_sms.preferences.DidPreference.java
public void showSelectDidDialog(boolean success, final String[] dids, String message) { if (progressDialog != null) { progressDialog.hide();// w ww . jav a 2s . co m progressDialog = null; } if (success) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), R.style.DialogTheme); builder.setTitle(getContext().getString(R.string.preferences_account_did_dialog_title)); builder.setItems(dids, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Preferences.getInstance(getContext()).setDid(dids[which].replaceAll("[^0-9]", "")); } }); builder.show(); } else { Utils.showInfoDialog(getContext(), message); } }
From source file:net.reichholf.dreamdroid.activities.TimerListActivity.java
@Override protected void onListItemClick(ListView l, View v, int position, long id) { mTimer = mMapList.get((int) id); CharSequence[] actions = { getText(R.string.edit), getText(R.string.delete) }; AlertDialog.Builder adBuilder = new AlertDialog.Builder(this); adBuilder.setTitle(R.string.pick_action); adBuilder.setItems(actions, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: editTimer(mTimer, false); break; case 1: deleteTimerConfirm();/* ww w .j a v a2 s . c o m*/ break; } } }); AlertDialog alert = adBuilder.create(); alert.show(); }
From source file:com.kircherelectronics.fusedgyroscopeexplorer.sensor.GyroscopeSensor.java
private void showGyroscopeNotAvailableAlert() { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); // set title//from ww w .j a v a 2s .co m alertDialogBuilder.setTitle("Gyroscope Not Available"); // set dialog message alertDialogBuilder.setMessage("Your device is not equipped with a gyroscope or it is not responding...") .setCancelable(false) .setNegativeButton("I'll look around...", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // if this button is clicked, just close // the dialog box and do nothing dialog.cancel(); } }); // create alert dialog AlertDialog alertDialog = alertDialogBuilder.create(); // show it alertDialog.show(); }
From source file:com.docd.purefm.ui.dialogs.PartitionInfoDialog.java
public Dialog onCreateDialog(final Bundle savedInstanceState) { final Activity activity = this.getActivity(); if (activity == null || activity.isFinishing()) { return null; }//from ww w . j a va 2s.com //noinspection InflateParams mView = activity.getLayoutInflater().inflate(R.layout.dialog_partition_info, null); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setIcon(ThemeUtils.getDrawableNonNull(activity, R.attr.ic_menu_info)); builder.setTitle(R.string.menu_partition); builder.setView(mView); builder.setNeutralButton(R.string.close, null); return builder.create(); }
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 .j a va 2 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; }