I’m basically creating a trivia type of game. Where you have a question and after you answer you press a button to see if you are right or not. Then you move on to the next question.
I’ve got one activity and an xml to control how it looks and gives user ability to interact with what’s on the screen. It currently shows one question. Now I need to have it change to a different question on the press of a button. The way it would work is the all the textView’s would change their text.
I want to have a way to store my questions, i.e. a set of strings for the textviews, and it’s information such as category, correct answer(s). And also the overall label for this question, which has to be an integer so I can randomly choose a question. I also want it to be able to retrieve all the data (as mentioned above) for a question using that integer. In other words each question is associated with an integer.
Does anyone have any ideas on which way I should implement this? I’m just looking for any suggestions that would make my life easier.
Using the Database for this is the old concept. The Best way is to use the XML parsing for that. It is an easy way to do that which you require. Simply get the data from the tags and show that on the controls. You can do this by simple XML Parsinng. For that purpose you have to add one xml file in your classes and then use that as follows
Also search on the google and if you feel problem i will help you. This link help you to understand the XML Parsing