identify correct answer in trivia app

I'm just about to get into my nitty gritty of my game-changing -_- trivia app but I was wondering before i start my database (SQLite), how would my app know when an answer selected is correct? I was thinking that I could simply put a column in the database for the answer and then have 4 seperate columns for the answers choices, of which one would be repeated -then simply compare the answer selected to the answer of the current row. But this doesn't seem like the most elegant solution. I was simply wondering if there were other methods that I didn't know about.

I don't know if it's worth mentioning but the answers choices would be shuffled before finally being placed into textviews.

Answers


I would suggest giving each answer a numeric value (PK from database) and storing the number of the correct answer against the question row in the "questions" table.

As for checking the correct answer, do you really want to be going back to your database for each question? If you app takes off and is used by a lot of people your db is going to be put under a lot of strain. Perhaps have the app download the "round" (set of questions) definition and do the answer checking locally for each round, uploading the results afterwards.


Need Your Help

Where Can I Learn How To Fit A Website To Fit Many Android Resolutions?

android html css android-layout mobile

Basically, I'm desinging websites for android phones, however, I'm finding that these phones have many different resolutions. The biggest problem is that some phones have a height of 800px and others

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.