List of usage examples for android.app AlertDialog.Builder setTitle
@Override public void setTitle(CharSequence title)
From source file:com.epunchit.user.FacebookActivity.java
public void inviteFriendsConfirmDialog() { final AlertDialog.Builder alert = new AlertDialog.Builder(mActivity); String title = "Are you sure you like to send this invite?"; alert.setTitle(title); alert.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { postOnWall();//from ww w .j a va 2 s . c o m postUserEvent(); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.show(); }
From source file:com.example.okano.simpleroutesearch.MapsActivity.java
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_A:// w w w . jav a 2 s .c o m showMapInfo(); //show_mapInfo(); return true; case MENU_B: //Legal Notices(?) String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext()); AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(MapsActivity.this); LicenseDialog.setTitle("Legal Notices"); LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show(); return true; case MENU_c: //show_settings(); return true; } return false; }
From source file:net.evecom.android.log.DailyLogAddActivity.java
/** * fh//from w w w . j a v a2s . c o m * * @param v */ public void logfh(View v) { final AlertDialog.Builder builder = new AlertDialog.Builder(DailyLogAddActivity.this); builder.setTitle(""); builder.setIcon(R.drawable.qq_dialog_default_icon);// builder.setMessage(""); builder.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { DailyLogAddActivity.this.finish(); Intent intent = new Intent(getApplicationContext(), DailyLogListActivity.class); startActivity(intent); } }); builder.setNegativeButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.show(); }
From source file:fi.mikuz.boarder.gui.internet.Login.java
private void showLoggedOutView() { setContentView(R.layout.internet_login_logged_out); mLogin = (Button) findViewById(R.id.submit); mUsername = (EditText) findViewById(R.id.userName); mPassword = (EditText) findViewById(R.id.userPassword); boolean usernameInDb = false; String dbPassword = null;//from ww w.j av a 2 s .co m try { Cursor loginCursor = mDbHelper.fetchLogin(InternetMenu.USERNAME_KEY); startManagingCursor(loginCursor); mUsername.setText(loginCursor.getString(loginCursor.getColumnIndexOrThrow(LoginDbAdapter.KEY_DATA))); usernameInDb = true; } catch (SQLException e) { Log.d(TAG, "Couldn't get database login info", e); } catch (CursorIndexOutOfBoundsException e) { Log.d(TAG, "Couldn't get database login info", e); } dbPassword = getDbPassword(); final CheckBox rememberPassword = (CheckBox) findViewById(R.id.rememberPassword); if (dbPassword == null) { rememberPassword.setChecked(false); } else { rememberPassword.setChecked(true); mPassword.setText(dbPassword); } final CheckBox rememberUsername = (CheckBox) findViewById(R.id.rememberUsername); rememberUsername.setChecked(usernameInDb); mLogin.setOnClickListener(new OnClickListener() { public void onClick(View v) { mWaitDialog = new TimeoutProgressDialog(Login.this, "Waiting for response", TAG, false); String username = mUsername.getText().toString(); String password = mPassword.getText().toString(); Boolean entrancePassword = true; String dbPassword = getDbPassword(); // Password in the Android database is always the same as in the server database // Being an entrance password means that the password is not the same as in the server database if (dbPassword != null) { if (dbPassword.equals(password)) { entrancePassword = false; } } // If the password is now an entrance password then it's plain text and wants to be hashed if (entrancePassword) { try { password = Security.passwordHash(password); } catch (NoSuchAlgorithmException e) { String msg = "Couldn't make a password hash"; Toast.makeText(Login.this, msg, Toast.LENGTH_LONG).show(); Log.e(TAG, msg, e); } } if (rememberUsername.isChecked()) { mDbHelper.putLogin(InternetMenu.USERNAME_KEY, username); } else if (!rememberUsername.isChecked()) { mDbHelper.deleteLogin(InternetMenu.USERNAME_KEY); } if (rememberPassword.isChecked()) { if (!entrancePassword) { mPasswordOperation = PASSWORD_OPERATION_NONE; mDbHelper.putLogin(InternetMenu.PASSWORD_KEY, password); } else { mPasswordOperation = PASSWORD_OPERATION_SAVE; } } else if (!rememberPassword.isChecked()) { mDbHelper.deleteLogin(InternetMenu.PASSWORD_KEY); } mDbHelper.deleteLogin(InternetMenu.USER_ID_KEY); mDbHelper.deleteLogin(InternetMenu.SESSION_TOKEN_KEY); CheckBox rememberSession = (CheckBox) findViewById(R.id.rememberSession); if (rememberSession.isChecked()) { mRememberSession = true; } HashMap<String, String> sendList = new HashMap<String, String>(); sendList.put(InternetMenu.USERNAME_KEY, username); sendList.put(InternetMenu.PASSWORD_KEY, password); sendList.put(InternetMenu.ENTRANCE_PASSWORD_KEY, entrancePassword ? "1" : "0"); new ConnectionManager(Login.this, InternetMenu.mLoginURL, sendList); } }); Button recoverPassword = (Button) findViewById(R.id.recoverPassword); recoverPassword.setOnClickListener(new OnClickListener() { public void onClick(View v) { LayoutInflater inflater = (LayoutInflater) Login.this.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.internet_login_alert_recover_password, (ViewGroup) findViewById(R.id.alert_settings_root)); final EditText input = (EditText) layout.findViewById(R.id.input); Button submitButton = (Button) layout.findViewById(R.id.submitButton); AlertDialog.Builder builder = new AlertDialog.Builder(Login.this); builder.setView(layout); builder.setTitle("Password recovery"); submitButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { mWaitDialog = new TimeoutProgressDialog(Login.this, "Waiting for response", TAG, false); String inputText = input.getText().toString(); HashMap<String, String> sendList = new HashMap<String, String>(); sendList.put(InternetMenu.EMAIL_KEY, inputText); new ConnectionManager(Login.this, InternetMenu.mRecoverPasswordURL, sendList); } }); builder.show(); } }); }
From source file:de.quadrillenschule.azocamsynca.job.JobProcessor.java
public void doTestShots(final TriggerPhotoSerie job) { final NikonIR camera = ((AzoTriggerServiceApplication) getActivity().getApplication()).getCamera(); final JobProcessor jobProcessor = ((AzoTriggerServiceApplication) getActivity().getApplication()) .getJobProcessor();/*from ww w . ja va 2 s .c o m*/ final AlertDialog.Builder adb = new AlertDialog.Builder(getActivity(), R.style.dialog); job.setTriggerStatus(PhotoSerie.TriggerJobStatus.WAITFORUSER); adb.setTitle("Test Shots"); adb.setMessage("This series collects all images during preparation of the project\n" + job.getProject() + "\n" + "Camera controls time: " + camera.isExposureSetOnCamera(job.getExposure())); if (!job.isToggleIsOpen()) { adb.setPositiveButton("Finish", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { job.setTriggerStatus(PhotoSerie.TriggerJobStatus.FINISHED_TRIGGERING); jobProcessor.fireJobProgressEvent(job); processingLoop(); } }); } adb.setNegativeButton("Trigger", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { camera.trigger(); if (!camera.isExposureSetOnCamera(job.getExposure())) { job.setToggleIsOpen(!job.isToggleIsOpen()); if (!job.isToggleIsOpen()) { job.setNumber(job.getNumber() + 1); job.setTriggered(job.getTriggered() + 1); } } else { job.setNumber(job.getNumber() + 1); job.setTriggered(job.getTriggered() + 1); } doTestShots(job); } }); MediaPlayer mediaPlayer = MediaPlayer.create(activity, R.raw.oida_peda); mediaPlayer.start(); // adb.create().show(); adb.create(); alertDialog = adb.show(); }
From source file:com.openerp.addons.note.EditNoteFragment.java
public void openDailogview(String title, String message, String positivebtnText, String negativebtnText) { AlertDialog.Builder deleteDialogConfirm = new AlertDialog.Builder(scope.context()); deleteDialogConfirm.setTitle(title); deleteDialogConfirm.setMessage(message); deleteDialogConfirm.setCancelable(true); deleteDialogConfirm.setPositiveButton(positivebtnText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { flag = true;/*from w ww . j a v a2 s .c o m*/ getActivity().getSupportFragmentManager().popBackStack(); } }); deleteDialogConfirm.setNegativeButton(negativebtnText, null); deleteDialogConfirm.show(); }
From source file:es.rczone.tutoriales.gmaps.MainActivity.java
private void showLegalNotice() { String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this); AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(this); LicenseDialog.setTitle("Legal Notices"); LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show();/* w w w . j a v a2 s . com*/ }
From source file:com.getkickbak.plugin.NotificationPlugin.java
/** * Builds and shows a native Android confirm dialog with given title, message, buttons. * This dialog only shows up to 3 buttons. Any labels after that will be ignored. * The index of the button pressed will be returned to the JavaScript callback identified by callbackId. * //from w ww . j a va 2s.c o m * @param message * The message the dialog should display * @param title * The title of the dialog * @param buttonLabels * A comma separated list of button labels (Up to 3 buttons) * @param callbackContext * The callback context. */ public synchronized void confirm(final String message, final String title, String buttonLabels, final CallbackContext callbackContext) { final NotificationPlugin notification = this; final CordovaInterface cordova = this.cordova; final String[] fButtons = (buttonLabels != null) ? buttonLabels.split(",") : new String[0]; Runnable runnable = new Runnable() { public void run() { AlertDialog.Builder dlg = new AlertDialog.Builder(cordova.getActivity()); dlg.setMessage(message); dlg.setTitle(title); dlg.setCancelable((fButtons.length > 0) ? true : false); // First button if (fButtons.length > 0) { dlg.setNegativeButton(fButtons[0], new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { notification.dismiss(-1, dialog); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 1)); } }); dlg.setOnCancelListener(new AlertDialog.OnCancelListener() { public void onCancel(DialogInterface dialog) { notification.dismiss(-1, dialog); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 0)); } }); } // Second button if (fButtons.length > 1) { dlg.setNeutralButton(fButtons[1], new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { notification.dismiss(-1, dialog); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 2)); } }); } // Third button if (fButtons.length > 2) { dlg.setPositiveButton(fButtons[2], new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { notification.dismiss(-1, dialog); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 3)); } }); } /* * dlg.setOnDismissListener(new AlertDialog.OnDismissListener() * { * public void onDismiss(DialogInterface dialog) * { * } * }); */ dlg.create(); Integer key = Integer.valueOf(((int) (Math.random() * 10000000)) + 10000); AlertDialog value = dlg.show(); notification.dialogsIA.put(key, value); notification.dialogsAI.put(value, key); if (fButtons.length == 0) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, key.intValue())); } }; }; this.cordova.getActivity().runOnUiThread(runnable); }
From source file:de.quadrillenschule.azocamsynca.job.JobProcessor.java
public void processingLoop() { if (getRequestStatus() == ProcessorStatus.PAUSED) { setStatus(ProcessorStatus.PAUSED); return;/* w w w .j a va2 s .co m*/ } setStatus(ProcessorStatus.PROCESSING); TriggerPhotoSerie currentJobT = null; for (TriggerPhotoSerie j : jobs) { if (j.getTriggerStatus() != TriggerPhotoSerie.TriggerJobStatus.FINISHED_TRIGGERING) { currentJobT = j; if ((j.getTriggerStatus() == PhotoSerie.TriggerJobStatus.WAITFORUSER) && ((alertDialog != null) && (alertDialog.isShowing()))) { return; } if ((j.getTriggerStatus() == PhotoSerie.TriggerJobStatus.WAITFORUSER)) { currentJobT.setTriggerStatus(PhotoSerie.TriggerJobStatus.NEW); } break; } } if (currentJobT == null) { setStatus(ProcessorStatus.PAUSED); return; } final TriggerPhotoSerie currentJob = currentJobT; final NikonIR camera = ((AzoTriggerServiceApplication) getActivity().getApplication()).getCamera(); if (currentJob.getTriggerStatus() == PhotoSerie.TriggerJobStatus.NEW) { currentJob.setTriggerStatus(PhotoSerie.TriggerJobStatus.WAITFORUSER); if (currentJob.getSeriesName().equals(PhotoSerie.TESTSHOTS)) { doTestShots(currentJob); return; } AlertDialog.Builder ad = new AlertDialog.Builder(getActivity(), R.style.dialog); ad.setTitle(currentJob.getProject() + ": " + currentJob.getSeriesName()); ad.setMessage( currentJob.getNumber() + " x " + (int) (currentJob.getExposure() / 1000) + "s\n\n" + "Delay after each exposure:" + currentJob.getDelayAfterEachExposure() / 1000 + "s\n" + "Camera controls time: " + camera.isExposureSetOnCamera(currentJob.getExposure()) + "\n" + "Total time: " + ((currentJob.getNumber() * (currentJob.getExposure() + currentJob.getDelayAfterEachExposure())) / 1000) + "s"); ad.setPositiveButton("Confirm", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { currentJob.setTriggerStatus(PhotoSerie.TriggerJobStatus.PREPARED); processingLoop(); } }); ad.setNegativeButton("Pause", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { currentJob.setTriggerStatus(PhotoSerie.TriggerJobStatus.NEW); pause(); } }); MediaPlayer mediaPlayer = MediaPlayer.create(activity, R.raw.oida_peda); mediaPlayer.start(); ad.create(); alertDialog = ad.show(); } final Handler handler = new Handler(); if ((currentJob.getTriggerStatus() == PhotoSerie.TriggerJobStatus.PREPARED || currentJob.getTriggerStatus() == PhotoSerie.TriggerJobStatus.RUNNING)) { handler.postDelayed(new Runnable() { public void run() { if ((((AzoTriggerServiceApplication) getActivity().getApplication()).getJobProcessor() .getStatus() == ProcessorStatus.PAUSED) && (!currentJob.isToggleIsOpen())) { return; } camera.trigger(); for (JobProgressListener j : jobProgressListeners) { j.jobProgressed(currentJob); } if (currentJob.getFirstTriggerTime() == 0) { currentJob.setFirstTriggerTime(System.currentTimeMillis()); } currentJob.setTriggerStatus(PhotoSerie.TriggerJobStatus.RUNNING); if (!camera.isExposureSetOnCamera(currentJob.getExposure())) { if (!currentJob.isToggleIsOpen()) { currentJob.setToggleIsOpen(!currentJob.isToggleIsOpen()); currentJob.setLastTriggerTime(System.currentTimeMillis()); } else { currentJob.setToggleIsOpen(!currentJob.isToggleIsOpen()); currentJob.setTriggered(currentJob.getTriggered() + 1); } } else { currentJob.setTriggered(currentJob.getTriggered() + 1); } if (currentJob.getTriggered() < currentJob.getNumber()) { long time; if (camera.isExposureSetOnCamera(currentJob.getExposure())) { time = currentJob.getExposure() + currentJob.getDelayAfterEachExposure(); } else { if (currentJob.isToggleIsOpen()) { time = currentJob.getExposure(); } else { time = currentJob.getDelayAfterEachExposure(); } } handler.postDelayed(this, time); } else { currentJob.setTriggerStatus(PhotoSerie.TriggerJobStatus.FINISHED_TRIGGERING); processingLoop(); } } }, currentJob.getInitialDelay()); } else { } }
From source file:net.naonedbus.activity.impl.CommentaireActivity.java
/** * Afficher une dialog de selection.//from w ww . j av a 2 s . com * * @param title * Le titre * @param adapter * L'adapter * @param defaultPosition * La position de l'lment slectionn par dfaut * @param onClickListener * Le callback */ private void showSelectDialog(final int title, final ListAdapter adapter, final int defaultPosition, final DialogInterface.OnClickListener onClickListener) { final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(title); builder.setSingleChoiceItems(adapter, defaultPosition, onClickListener); builder.show(); }