android nested lists
Posted
by
Raogrimm
on Stack Overflow
See other posts from Stack Overflow
or by Raogrimm
Published on 2012-06-12T04:34:38Z
Indexed on
2012/06/12
4:40 UTC
Read the original article
Hit count: 147
i'm new to programming android and i have found some useful things for my app, but i can't seem to find how to make a list filled with an string array display a new list that is going to be populated with a string array. i would like to have the user choose an item from the top_menu
list and from there go to the desired area and have that array appear.
this is what i have so far:
public class HelloListActivity extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String[] top_menu = getResources().getStringArray(R.array.top_menu);
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, top_menu));
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
???
}
});
}
all my arrays are working fine, i just don't know how to repopulate a new list with the other array depending on the choice the user made.
any help is greatly appreciated
© Stack Overflow or respective owner