# How to keep the questions in Math game application ?

I would like to create a simple Math game application in android phone but I don't know what kind of data storage which I should use to keep the sets of numeric for the questions. At this time, I am hesitating with the SQLite and text file. Please suggest me. And If you have any tutorial or example, please give me them.

• Your question is hard to understand, and if I am understanding you correctly, you want to know how you should store data for the game to read? The answer to that is however you want to that makes it easy to use. Feb 23 '12 at 16:45
• What kind of questions will you be asking and how will you be receiving answers? Can you provide a few samples? Feb 23 '12 at 17:35

You have lots of choices with android. As the Luis has sated, SQLite or text files (XML, JSON). But you could also store the data in a key-value list, such as a dictionary list or storage list.

Depending on how complex the data is, and what works easiest for yourself will determine what is the best option

What kind of questions are you going to be asking in this application?

something like?:

1 + 1 = ?
6 / 2 = ?


any type of storage is possible, you can use a comma delimited file such that every line would have the question and the answer like so:

"1 + 1","2"
"6 / 2","3"


If you are going to use SQL then you can make a table with the Questions & Answers. You would have two columns "Question" & "Answer" same thing as above.

• Building on this answer, SQLite or text files are I believe a pretty standard way to store local content. Text files might be simpler, but if you store a number of math problems in the same file, you will need to come up with design for storing them, such as one per line. My advice would be to spend some time to learn how to use them and they can solve your problem. The Android developer page on data storage is at developer.android.com/guide/topics/data/data-storage.html if that is useful. Feb 23 '12 at 17:23
• Heck, if your questions are as simple as 1 + 1 = ?, why not just select two operands, an operator, and calculate an answer on the fly and completely forego the need for storing questions? (Unless you're tracking performance or something as well, of course.) Feb 23 '12 at 17:34
• What a waste! @chaosTechnician is right. Smartphones' CPU can generate this kind of question easily. Feb 23 '12 at 20:52
• The OP didn't state what kind of questions the application would be asking. These are just examples. Having static questions that are more complicated like "5 + 5 / 2 * 3 - 2 + 8" is much easier than generating the expression and parsing it to find the answer. The OP didn't even state if the questions would be word problems or pure math expressions. Overall the OP is hard to understand. Feb 23 '12 at 21:03
• @user13781, The comment you're referring to was a comment on the answer that Luis Estrada gave about how, if the questions were that simple, there's no need to store anything. Take it personally if you want to but do notice my comment on your original question was asking you (politely) for more clarification. :roll: Feb 24 '12 at 18:59