How to manage onItemClickListener using ListActivity
I've got some idea in my mind but I don't how to get started.
There is a one listview, firstly listadapter contains for example names of coubtries, then in onItemClickListener:
- when I tap some country, listadapter will be changed and on list will show cities connected with chosen country
- when I press back arrow (android button) listadapter should change and I'll see countries as at beginning
- when I tap some cities I'll go to other activity
Is it wise and comfortable to make this task in 开发者_如何学Pythonmentioned way?
--
the question is how to switch the one listview onitemclicklistener for the second one, and make working back arrow?
I would have two different ListView
s, one for countries and one for cities. The country ListView
would be static (its content unchanging, not Java static
). The cities ListView would change as countries were selected, and would only be populated once a country was chosen.
What about two different ListView activities, where the country selected in the first one was passed into the 2nd one that did some database lookup or whatever and showed the cities in the selected country?
精彩评论