views:

38

answers:

1

I have a ViewFlipper that presents 3 different views.

Is it possible to have 3 classes manage* the 3 different views? If so, how do I go about doing this?

  • For example, if View 1 shows a List of News and View 2 Shows a List of Prices, I want to have a News class that handles the interaction of the listview in News, and a Prices class that handles the interaction of the listview in Prices
A: 

Why don't you make your News and Prices class contain all of your application logic as you said. If you make them extend ListView you can then add them to your ViewFlipper and treat them in the same way, but they will have the specific behaviour as dictated by whatever you put in the News and Prices classes.

Alternatively, just set a different listView.setAdapter() [to populate], and listView.setOnItemSelectedListener() [to alter behaviour] for each ListView you have in your ViewFlipper.

antonyt