February 27th, 2011, 03:06 PM
Join Date: Dec 2010
Location: Aarhus, Denmark
Device(s): SE Xperia X10
Carrier: Not Provided
Thanked 22 Times in 22 Posts
well... One way to do it is by using the built in strings.xml to set it up. In that file you can can set up strings and more importantly, string-array's. you can use this to fill out the different values in each belts sub-activities. It goes something like this:
Your list contains a certain number of belts. As a belt is clicked the listview can provide you with the position of the clicked item. Save this position in a static variable in the listview activity - say we call it selectedBeltID.
Then android loads you tabhost activity and shows e.g. Syllabys. In there you have to fill in data about the corresponding belt. To get the right data you then load a systemResource i.e. the right string array - say there is one called syllabus_headers.
In that string-array you input items with data corresponding to the belt id's. So if e.g. the black belt is the first in your listview, then the first item in all the arrays should be about the black belt etc.
Then, when Syllabus needs to fill data into, in this case, its header textview, the text is loaded from the syllabus_headers array, and from the item in place "selectedBeltID" (referencing the static variable set earlier).
This way you can reuse all the same activities for showing data about the different belts and you only have one place to edit and update that data - in your resource files. The same thing goes for stuff like integer arrays and so on.
And if you have some data that is only there in some special cases you can use the "selectedBeltID" as a check to see whether or not to show that data.
Hope this was something of what you were looking for. If not, please specify!