Reputation: 14367
I have the following thing to achieve in Android(newbie). I have an xml which has contents in this format
<xml>
<parent id = 1 Name = "Cat" >
<child id = 3>
<child id = 4>
</parent>
<child id=3 Name = "Video">
<raw id =6>
</child>
<child id=4 Name = "Text">
<raw id =7>
</child>
<raw id=6 destination="www.cat.com">
</raw>
<raw id=7 destination="www.cat.pdf">
</raw>
</xml>
So basically i want one screen to show parent ids in our case "CAT". On clicking CAT, it has to move to the next screen which shows the children of CAT which is "Video" and "Text". On clicking Video it has to play video from the mention location. How do I achieve this. Please help.
Upvotes: 0
Views: 242
Reputation: 288
You can populate "string.xml -> array" with yours items,
So basically i want one screen to show parent ids in our case "CAT". On clicking CAT, it has to move to the next screen which shows the children of CAT which is "Video" and "Text". On clicking Video it has to play video from the mention location. How do I achieve this. Please help.
The first activity you implement this:
String[] parent= getResources().getStringArray(R.array.parent);
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, parent));
You can learn about it on the developer's site.
Upvotes: 1
Reputation: 14367
Well I ended up putting the xml data into a sqlite database and using a cursor adapter to feed listviews to populate lists.
Upvotes: 0