Android, Storing and retrieving Text

Viewed 98

I'm currently working on an Android application for my college, let me give you a swift presentation:

There is a story which the player can read, and then he will have 3 choices, he will choose one, and another story will show up with 3 choices again and so it goes on... (But every choice lead to a complete different story)

As you can guess, i have a lot of text to store, to class and to retrieve. The first page shows the first story and 3 choices, if the player chooses and clicks on a button, the following story will appear but it can also mean the end (obviously if i always keep 3 paths X 3 paths X 3 paths... it's going to get complicated)

_______________ What I was thinking about ____________________________

So my first guess was to use an xml file, one with every story and another with every choice.

At the opening of the application, i would use a parser to run through the file and put every string in a Tree Structure. (so one tree for the stories and another for choices I suppose)

I wanted to use number to structure it, for exemple, if you are currently on 1 and you click on choice 2 then you put another 2 at the end of the previous story, it will become 12, and then if you click on choice 3, it become 123 etc... I though it was easier for the tree, alas, xml only give a tag name so i wanted to use story1, story11, story12, story13 etc...

What the structure of my xml should look like (or my tree)

But it's already bothering to class it in a tree since i wanted to use numbers, I have to get a String with parser.parName(), and then I need to substring to get the number at the end, and just to retrieve in what node it should go take some ressources.

In other means, the more I think about it, the more I come up with complicated ideas, so I need some smart people to tell me where to go. (I have clearly lost myself on the road)

__________________________________ My question ____________________________

If you feel like this smart one, here is my question

What would you use to store the text? an Xml file? would you use a tree after that? And how would you do that, to efficiently class the xml into the Tree?

I can see that my explanation is a bit messy, so please tell me if they are something you don't understand. (or if it is my broken english)

Thanks for answering !

2 Answers
Related