Quiz App Question

Hello there; currently I'm reading a book intended for the use with Android 1.5 and 1.6 platforms; however I am developing on the 2.0.1 platform.

So far I am novice at best when it comes to Android development; however I am learning at a steady and fast rate (I use C# and Java regularly)

Currently I have a sneaking suspicion that I am going about the development of a simple quiz application incorrectly or inefficiently. This is what I've done:

Using XML Layout files, I have created layouts for the main screen, the about page, and all of the subsequent quiz pages (I have a layout for each page which contains a text view for the question, along with buttons representing all of the possible answers)

I have made classes for each of the pages of my quiz application (Each question is dedicated to it's own page) and to move to the next page, I simply create an intent to use the next page's class; and then switch the current layout when it has reached the next page's class.

I am simply using what I've learned from the first few chapters of the book; and I can already see that my quiz application is becoming very rigid and procedural; when ideally I would like it to be object oriented and easily modify-able for future releases.

Is it standard practice to have all of the layouts and contents of the layouts like this "built in" or am I going about this incorrectly?

Like you, I'm fairly new with Android, I've written a couple of application but nothing of production quality yet. So please, take this as a discussion not an answer. I have done on-line testing applications for student pilots.

I'm not sure if I completely understand your program design. It sounds like you are developing a class for each question at compile time. I would suggest a class for each type of question (true/false, multiple choice, match) and a new object for each question created from the proper class.

I think you might be missing the runtime method for a TextView setText(CharSequence txt).

I would probably have an object constructor something like TFQuestion(String q, String t, String f, Boolean ans) that is derived from an abstract base class say Question;

Where you get the questions is another issue but for testing as a static array could look something like

Like you, I'm fairly new with Android, I've written a couple of application but nothing of production quality yet. So please, take this as a discussion not an answer. I have done on-line testing applications for student pilots.

I'm not sure if I completely understand your program design. It sounds like you are developing a class for each question at compile time. I would suggest a class for each type of question (true/false, multiple choice, match) and a new object for each question created from the proper class.

I think you might be missing the runtime method for a TextView setText(CharSequence txt).

I would probably have an object constructor something like TFQuestion(String q, String t, String f, Boolean ans) that is derived from an abstract base class say Question;

Where you get the questions is another issue but for testing as a static array could look something like

ps. I'm having trouble formatting this post. All new lines are being ignored.

Click to expand...

Wow. This makes a hell of a lot more sense; thanks

Now I'm just experiencing some confusion when it comes to ListViews.

For my application; the questions have varying numbers of answers. I figured the best way to implement this would be to do the following:

+LinearLayout
+-TextView (Question text)
++ListView (List of answers)

I am considering using a sqlite database of three tables to store the information; one table that represents every quiz on the device, one table that represents every question on the device (each contain the id of which quiz they belong to), and a answer table (each contains the id of which question they belong to)

The list view part is just confusing me right now; I'm trying to follow Google's notepad example since it seems to be almost exactly what I want; however Eclipse doesn't want to open their project files, and unfortunately the tutorial doesn't start from scratch.