List of usage examples for android.app AlertDialog.Builder setMessage
public void setMessage(CharSequence message)
From source file:fi.mikuz.boarder.gui.internet.InternetMenu.java
@Override public void onConnectionSuccessful(ConnectionSuccessfulResponse connectionSuccessfulResponse) throws JSONException { ConnectionUtils.connectionSuccessful(InternetMenu.this, connectionSuccessfulResponse); if (ConnectionUtils.checkConnectionId(connectionSuccessfulResponse, InternetMenu.mGetServiceVersionURL)) { mDatabaseVersionChecked = true;/*from w w w .ja v a 2s. c om*/ int serviceVersion = connectionSuccessfulResponse.getJSONObject().getInt(ConnectionUtils.returnData); if (serviceVersion == -1) { AlertDialog.Builder builder = new AlertDialog.Builder(InternetMenu.this); builder.setTitle("Maintenance"); builder.setMessage("Boarder web service is under maintenance. Please try again later."); builder.setCancelable(false); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { InternetMenu.this.finish(); } }); builder.show(); } else if (mServiceVersion < serviceVersion) { AlertDialog.Builder builder = new AlertDialog.Builder(InternetMenu.this); builder.setTitle("Old version"); builder.setMessage( "You have an old version of Boarder. Your version is not compatible with Boarder web service.\n\n" + "Please update."); builder.setCancelable(false); builder.setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { ExternalIntent.openGooglePlay(InternetMenu.this); InternetMenu.this.finish(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { InternetMenu.this.finish(); } }); builder.show(); } } else if (ConnectionUtils.checkConnectionId(connectionSuccessfulResponse, InternetMenu.mGetSessionValidURL)) { mSessionValidityChecked = true; if (connectionSuccessfulResponse.getJSONObject().getInt(InternetMenu.SESSION_VALID_KEY) == 0) { startLogin(); } else { String accountMessage = connectionSuccessfulResponse.getJSONObject() .getString(InternetMenu.ACCOUNT_MESSAGE_KEY); updateAccountMessage(accountMessage); } } afterConnection(); }
From source file:com.poinsart.votar.VotarMain.java
@Override public void onBackPressed() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(getString(R.string.quit_title)); alert.setMessage(getString(R.string.quit_message)); alert.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { finish();/*from w w w . java2s.co m*/ } }); alert.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // } }); alert.show(); }
From source file:de.quadrillenschule.azocamsynca.job.JobProcessor.java
public void processingLoop() { if (getRequestStatus() == ProcessorStatus.PAUSED) { setStatus(ProcessorStatus.PAUSED); return;/* w ww . j a va2s . c om*/ } 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:com.nokia.example.capturetheflag.Controller.java
@Override public void onError(JSONResponse error) { Log.w(TAG, "onError()"); AlertDialog.Builder errordialog = new AlertDialog.Builder(getActivity()); errordialog.setTitle("Error"); if (error.getErrorCode() == JSONResponse.ERROR_GAME_FULL) { errordialog.setMessage(getString(R.string.game_full)); } else if (error.getErrorCode() == JSONResponse.ERROR_EXCEPTION) { errordialog.setMessage(error.getException().getMessage()); }/*from w w w .j av a 2 s .c o m*/ errordialog.setPositiveButton(getString(android.R.string.ok), new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); MainActivity m = (MainActivity) getActivity(); m.showGameMenu(null); } }); errordialog.create().show(); }
From source file:org.deviceconnect.android.uiapp.DConnectActivity.java
@Override protected void onResumeFragments() { super.onResumeFragments(); // ?????????//from w w w . jav a2s . c o m if (mError != null) { clearFragmentList(); mLoadingFragment = new DialogFragment() { @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final AlertDialog.Builder builder = new AlertDialog.Builder(DConnectActivity.this); builder.setTitle(R.string.activity_failed_to_get_accesstoken); builder.setMessage(mError.toString()); builder.setCancelable(true); mError = null; return builder.create(); } }; mLoadingFragment.show(getSupportFragmentManager(), "test"); } }
From source file:com.spoiledmilk.cykelsuperstier.break_rote.BreakRouteActivity.java
private void showRouteNoBreakDialog() { if (dialog == null) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(CykelsuperstierApplication.getString("no_route")); builder.setMessage(CykelsuperstierApplication.getString("cannot_broken")); builder.setPositiveButton("OK", new OnClickListener() { @Override/*ww w.j a va 2 s . com*/ public void onClick(DialogInterface dialog, int arg1) { dialog.dismiss(); finish(); overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right); } }); dialog = builder.create(); dialog.setCancelable(false); } dialog.show(); }
From source file:com.cm.android.beercellar.ui.ImageDetailFragment.java
private void deleteImage() { AlertDialog.Builder builder = new AlertDialog.Builder(ImageDetailFragment.this.getActivity()); builder.setMessage("Delete?").setPositiveButton("Delete now", new DialogInterface.OnClickListener() { @Override/*from w w w . j av a 2s .com*/ public void onClick(DialogInterface dialog, int id) { // Yes-code mProgressBar.setVisibility(View.VISIBLE); //String[] params = {mImageUrl, mThumbnailUrl}; //new DeleteImageAsyncTask().execute(params); try { //delete files under Pictures File imageFile = new File(mImageUrl); File thumbnailFile = new File(mThumbnailUrl); //delete thumbnail first for better ux if (thumbnailFile.delete() && imageFile.delete()) { List<Object> data = new ArrayList<Object>(); //delete thumbnail first data.add(mThumbnailUrl); data.add(mImageUrl); //delete files in the cache mImageFetcher.deleteImages(data, ImageDetailFragment.this); //database mDbHelper.deleteNote(mRowId); } else { Log.e(ImageDetailFragment.class.getName(), "Unable to delete files"); Toast.makeText(getActivity(), "Unable to delete", Toast.LENGTH_SHORT).show(); } } catch (Exception e) { Log.e(ImageDetailFragment.class.getName(), e.getMessage()); } //getActivity().finish(); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).show(); }
From source file:net.evecom.android.log.DailyLogAddActivity.java
/** * fh//from www . j a v a 2 s . 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:org.ambientdynamix.core.HomeActivity.java
private void updateCheck() { new Thread(new Runnable() { @Override/* w w w . java 2 s.com*/ public void run() { try { PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); int verCode = pInfo.versionCode; DefaultHttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet("http://repo.smartphone-experimentation.eu/app/"); try { HttpResponse execute = client.execute(httpGet); InputStream content = execute.getEntity().getContent(); BufferedReader buffer = new BufferedReader(new InputStreamReader(content)); StringBuilder builder = new StringBuilder(); String s = ""; while ((s = buffer.readLine()) != null) { builder.append(s); } try { if (verCode != Integer.parseInt(builder.toString())) { { final AlertDialog.Builder alertBuilder = new AlertDialog.Builder(activity); alertBuilder.setTitle("Update Available"); alertBuilder.setMessage( "There is a newer version available for Organicity Experimentation. " + "Please click 'Update' to download and install the latest version."); alertBuilder.setPositiveButton("Update", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent browserIntent = new Intent(Intent.ACTION_DEFAULT, Uri.parse( "http://repo.smartphone-experimentation.eu/app/dynamix-framework-debug.apk")); startActivity(browserIntent); } }); alertBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); runOnUiThread(new Runnable() { @Override public void run() { alertBuilder.show(); } }); } } } catch (Exception ignore) { } } catch (Exception ignore) { } } catch (PackageManager.NameNotFoundException e) { } } }).start(); }
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();/*from ww w .j a v a 2 s. 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(); //} }