public void onSaveClick(View button) { AndroidDeferredManager deferredManager = new AndroidDeferredManager(); deferredManager.setAutoSubmit(true); Data data = new Data(); Spinner spinna = (Spinner) findViewById(R.id.user_name); data.name = spinna.getSelectedItem().toString(); TextView view; view = (TextView) findViewById(R.id.location_name); data.location = view.getText().toString(); view = (TextView) findViewById(R.id.booty_name); data.booty = view.getText().toString(); final TextView errorView = (TextView) findViewById(R.id.error_view); deferredManager.when(postYourBooty(data)).always(logger()); if (errorView != null) { errorView.setText("Posting data"); } }
@Override protected void onCreate(Bundle savedInstanceState) { Log.i(BOOTY, "onCreate called"); super.onCreate(savedInstanceState); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main); manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, gpsListener()); manager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, gpsListener()); MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map); map = mapFragment.getMap(); map.setOnInfoWindowClickListener(infoWindowClickListener()); map.setOnMarkerClickListener(markerClickListener()); map.setMyLocationEnabled(true); map.moveCamera(toMyPosition(null)); final BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.small_chest); for (Bar bar : Bar.defaultBars) { MarkerOptions options = new MarkerOptions(); options.title(bar.title); options.position(bar.location); options.icon(icon); map.addMarker(options); } AndroidDeferredManager deferredManager = new AndroidDeferredManager(); deferredManager.setAutoSubmit(true); String username = getIntent().getStringExtra(SplashyActivity.USERNAME); myUser = User.fromName(username); Typeface piratey = Typeface.createFromAsset(getAssets(), "fonts/pirate_font.ttf"); ((TextView) findViewById(R.id.info_view)).setTypeface(piratey); ((TextView) findViewById(R.id.location_name)).setTypeface(piratey); ((TextView) findViewById(R.id.save_button)).setTypeface(piratey); ((TextView) findViewById(R.id.spinner_label)).setTypeface(piratey); setupSpinnerEntries((Spinner) findViewById(R.id.user_name)); }