Trivia Game
#29, #30, and # 31 Page 218 & 219
Write a quiz app using SQLite
We'll discuss design in class, but I envision a screen where the player presses a button and it randomly selects a question, puts it on the screen with several answers, the player selects an answer and the app tells if its correct or not.
Randomly select a question from the database
I think you need to programatically build the question page, this will allow for a new question easier.
Then add a ADD, EDIT, and DELETE feature like the candy store app we did in class. Where the user can add,edit or delete questions and their answers.
You need a table with possibly 6 fields:
- ID
- Question
- Answer1
- Answer2
- Answer3
- Answer4
I recommend you design your table so that Answer 1 holds the correct answer. When you display a question on the screen you'll need to scramble the answers.
Have a "Toast" pop up telling them if their selection was correct or not.
If users hits incorrect answer then change the background color of the correct answer to let them know which was the correct answer.
Need a button to move the the next question
Use menu/toolbar to display the links to
Screen schots of my Trivia Game Solution (I made state capitol trivia)
Notes:
The last screen is the delete question screen where you just tap the qustion to delete it, like the candy store app. I also only have the Add, Delete, and Edit menu items on the initial page. I also pre-load the table with 17 state triva questions in the MainActivity.java, I just repeatdely call the add record from the database class and hard code the questions and answers. I blank out the table 1st so it doesn't keep adding those questions every time its played.
|