@Override public void onEvent(Event event) { SearchAddressModel model = (SearchAddressModel) event.getSource(); addresses = model.getAddresses(); // Update the adapter of the activity adapter.clear(); for (AddressModel address : addresses) { adapter.add(address.getFormattedAddress()); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate()"); setContentView(R.layout.list); // Initialize the list adapter for showing addresses adapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, new ArrayList<String>()); setListAdapter(adapter); // Connect Model, View, Controller addressModel = new SearchAddressModel(); addressModel.addEventListener( SearchAddressModel.AddressEvent.ADDRESSES_CHANGED, addressChangedListener); controller = new AddressSearchableController(this, addressModel); controller.handleIntent(getIntent()); }