private void setSavedCheckins(int id) { Checkin checkin = model.fetchPendingCheckinById(id); if (checkin != null) { this.latitude = Double.valueOf(checkin.getLocationLatitude()); this.longitude = Double.valueOf(checkin.getLocationLongitude()); view.mCheckinMessageText.setText(checkin.getMessage()); view.mCheckinLocation.setText(String.format("%f, %f", latitude, longitude)); // set the photos pendingPhoto.refresh(id); } }
private void addCheckins() { view.dialog.show(); Checkin checkin = new Checkin(); checkin.setPending(1); checkin.setMessage(view.mCheckinMessageText.getText().toString()); checkin.setLocationLatitude(String.valueOf(this.latitude)); checkin.setLocationLongitude(String.valueOf(this.longitude)); checkin.setDate((new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date())); // set location to unknown so to save failed checkin to a database. checkin.setLocationName(getString(R.string.unknown)); Bundle checkins = new Bundle(); checkins.putString("firstname", view.mFirstName.getText().toString()); checkins.putString("lastname", view.mLastName.getText().toString()); checkins.putString("email", view.mEmailAddress.getText().toString()); checkins.putInt("pending", 1); checkins.putString("message", view.mCheckinMessageText.getText().toString()); checkins.putString("latitude", String.valueOf(this.latitude)); checkins.putString("longitude", String.valueOf(this.longitude)); checkins.putString("date", (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date())); checkins.putString("location", getString(R.string.unknown)); checkins.putInt("id", id); uploadCheckins = new Intent(this, UploadCheckins.class); uploadCheckins.putExtras(checkins); startService(uploadCheckins); }