Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

Appreciate your help.

share|improve this question
    
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. –  Tetrad Feb 23 '12 at 16:45
2  
What kind of questions will you be asking and how will you be receiving answers? Can you provide a few samples? –  chaosTechnician Feb 23 '12 at 17:35
add comment

2 Answers

up vote 5 down vote accepted

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

share|improve this answer
add comment

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.

share|improve this answer
1  
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. –  Tim Holt Feb 23 '12 at 17:23
4  
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.) –  chaosTechnician Feb 23 '12 at 17:34
1  
What a waste! @chaosTechnician is right. Smartphones' CPU can generate this kind of question easily. –  Gustavo Maciel Feb 23 '12 at 20:52
1  
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. –  Luis Estrada Feb 23 '12 at 21:03
1  
@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: –  chaosTechnician Feb 24 '12 at 18:59
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.