@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { debug( 0, "requestCode=" + requestCode + ", REQUEST_ADD_TO_TRIP=" + ADD_TO_TRIP + ", CALENDER=" + CALENDAR + ", etc..."); if (resultCode == Activity.RESULT_CANCELED) { return; } switch (requestCode) { case ADD_TO_TRIP: debug( 2, "Returned pois to add to trip!"); // From using PoiList to select new POIs to add to // trip trip = data.getParcelableExtra(IntentPassable.TRIP); pois = trip.getPois(); poiAdapter.replaceAll(pois); lv.setAdapter(poiAdapter); poiAdapter.notifyDataSetChanged(); break; case CALENDAR: this.trip = data.getParcelableExtra(IntentPassable.TRIP); poiAdapter.notifyDataSetChanged(); break; default: debug(0, "No handler for result=" + resultCode); break; } } // onActivityResult
/** Initializes the activity. */ private void init() { db = DBFactory.getInstance(context); res = getResources(); if (getIntent().getParcelableExtra("trip") != null) { trip = (Trip) getIntent().getParcelableExtra("trip"); title = (TextView) findViewById(R.id.triplabel); title.setText(trip.getLabel()); } else { debug(0, "No trip supplied.. exit activity"); this.finish(); } debug(2, "FreeTrip=" + trip.isFreeTrip()); lv = getListView(); lv.setOnItemLongClickListener(new DrawPopup()); poiAdapter = new PoiAdapter(this, R.layout.plan_listitem, pois); lv.setAdapter(poiAdapter); for (Poi p : trip.getPois()) { pois.add(p); } } // init