I'm pretty new to java programming and am looking to do basic data mappings. I have a ListView object with a simple data array setup like this:
setListAdapter(new ArrayAdapter<String>(this, R.layout.my_list_xml, MY_DATA));
What I want to happen is when you click an item it goes to it's subcategory. I'm not worried about switching the data when an item is clicked. I'm just not sure how to create the data set in an efficient way using Android. Eventually this will be driven by a database but I want to figure out how to use mock-data to get this working first. An example of what I need the data structure will be is like:
myData = { 'category1' =>
{ 'subcategory1' => 'subcategorydetail1',
'subcategory2' => 'subcategorydetail2'},
'category2' =>
{ 'subcategory3' => 'subcategorydetail3',
'subcategory4' => 'subcategorydetail4'}
}
I'd like to be able to access it like myData['category2'] or myData['category2']['subcategory3']
Should I create this in xml files and link them up or is it best to create a new class structure for it?
Thanks for your help!