Reputation: 4269
I'm looking to gather user input from a series of ListViews. I need to store selections until the end of the series, at which point I'll put them into an SQLiteDb.
Is there a better way than, startActivityForResult(listView1)
, make selection, onActivityResult { save selection, startActivityForResult(listView2) }
, etc... ?
Upvotes: 0
Views: 176
Reputation: 1007434
I would recommend that this all be one activity, using either a single ListView
(replacing the adapter each time), or perhaps a ViewFlipper
holding your ListViews
. Manage the BACK button yourself.
At the risk of quoting myself, from Pattern "One activity, multiple views": Advantages and disadvantages :
Coase's "nature of the firm" theory says that businesses expand until the transaction costs for doing things internally become higher than the transaction costs for having other firms do the same things.
Murphy's "nature of the activity" theory says that the activity expands until the transaction costs of doing things internally become higher than the transaction costs for having other activities do the same things. Android developers will tend towards a "user transaction" model for activities -- things that are tightly coupled (e.g., steps in a wizard) will tend to be handled in single activity, and things that have little relationship (e.g., browse vs. search vs. settings vs. help vs. about) will tend to be handled in distinct activities.
Your case sounds too tightly coupled for independent activities -- more like a wizard -- and so that's why I recommend doing it all in one.
Upvotes: 1