Saved searches

Use saved searches to filter your results more quickly

Cancel Create saved search Sign up Reseting focus

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

An android library project to use for different types of multiple-answer quiz applications. In particular the templates provides 2 kind of quiz mode (educational games or trivia), a quiz domain model and logic and a lot of extensible UI elements.

Notifications You must be signed in to change notification settings

ghiottolino/android-quiz-template

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Go to file

Folders and files

Last commit message Last commit date

Latest commit

History

View all files

Repository files navigation

android-quiz-template

Introduction

Moreover the library provides a quiz domain model and logic and a lot of extensible UI elements.

In an educational game the user really has to focus when giving an answer and try to memorize the correct answers. If the wrong answer is given, the user should try answering again until she founds the correct answer. A simple but clever repetition algorithm will make the user learn from her mistakes: the wrongly answered question will be asked again soon, so the user have the possibility to answer correctly the next time (and learn!).

The Trivia game is the more classic and fast kind of game: the user sees a question and a bunch of answers, and try to guess the correct one. Both if the answer is correct or not the next question will be shown and the answered question will not be asked again in the game session.

How to create a Quiz in 4 easy steps

  1. Create your own Questions (i.e. with you own QuestionGenerator) The most important element in a quiz is a question, which is made of a question text, a list of answers (at least one shoul be correct) and a list of categories. You should learn how to create a question, here is an example:
String questionText = "Question Text?"; ListAnswer> answers = new LinkedListAnswer>(); answers.add(new Answer("Correct Answer", true)); answers.add(new Answer("Wrong Answer", false)); answers.add(new Answer("Wrong Answer", false)); answers.add(new Answer("Wrong Answer", false)); ListString> categories = Arrays.asList("category1", "category2"); Question question = new Question(questionText, answers, categories );

It's a good practice to create a class (i.e. QuestionGenerator) that "generates" a List of questions (List questions) in order to decouple the components of the tests. The Question generation is in many cases where the android-quiz-templates applications differentiate from each others:

  1. Load you questions database:

Before starting your game, wherever in your application you should initialize the QuestionDatabase. The QuestionDatabase will be initialized just once for each execution of you app, if it already holds some questions, nothing happen. For doing so, get an instance of the singleton QuestionDatabase object, and initialized it with a list of questions.

QuestionDatabase qd = QuestionDatabase.getInstance(); ListQuestion> questions = new MyQuestionGenerator().getQuestions(); qd.prepare(questions);
  1. Create you quiz activity:

Create a MyQuizActivity which extends either QuizActivity or EduQuizActivity

public class MyQuizActivity extends QuizActivity
  1. In your Activity (MyQuizActivity) initialize a game and start playing:
@Override protected void onCreate(Bundle savedInstanceState) < super.onCreate(savedInstanceState); setContentView(R.layout.quiz); SessionUtils.setSession(this, new Session()); //create an empty session TriviaGame game = new TriviaGame(QuestionDatabase.getInstance(),new ArrayListString>()); //starting a TriviaGame after having GameHolder.setInstance(game); loadRecord(); displayNextQuestion(); >

How to create a Quiz application using Android Annotations

The android-quiz-template library does not depend from AndroidAnnotations, but as I am big fan of it, I wanted to build my applications using it. So I had to tweek a bit the library code in order to make it more easily accessible also from classes annotated with @EActivity.

In order to use the annotations for creating a quiz, you can still follow the points 1 to 3 changing you code in a more android annotations fashion, but I reccomend you to pay attention to step 4, and using this snippet as referiment:

@EActivity(R.layout.quiz) public class MyQuizActivity extends QuizActivity < @Override protected void onCreate(Bundle savedInstanceState) < super.onCreate(savedInstanceState); > @AfterViews protected void afterViews() < initViews(); SessionUtils.setSession(this, new Session()); TriviaGame game = new TriviaGame(QuestionDatabase.getInstance(),new ArrayListString>()); GameHolder.setInstance(game); loadRecord(); displayNextQuestion(); >

Applications implemented using this framework

German Gender Quiz

For testing your knowledge of german words gender. This game consists of guessing the gender of a German word. At every stage you will see a random German noun, and you can guess its gender by clicking on the 3 buttons ('der' for masculine, 'die' for feminine and 'das' for neutral words).

What's Playing

What's playing? allows you to test your musical culture by listening and guessing tracks' titles, artists' names and release year of popular songs!

Soon in the play store!

German Verb Prepositions Quiz

The quiz consists of guessing the prepositions (and the case) fitting to a German verb. At every stage you will see a random German verb, and you can guess the prepositions (1 ore more possible correct answers are possible) by clicking on the correct button. If the verb could be combined with more than one preposition the number of correct answers is shown in brackets at the end of the question.

German Adjective Declension

The purpose of the game is to decline the adjective of the given german sentences, according to gender, number and case of the noun and the type of declination (definite articles, undefinite articles, null articles). It also provides an handy cheatsheet for learning more about adjective declension.

Algebra Quiz

For testing your algebra skills, and train the four basic mathematical operations. You can also choose if you want to separately train the addition, the division, the multiplication or the division. This app is useful for both kids learning the basic operations and adults willing to do some mental gymnastics.

English irregular verbs quiz

The quiz consists of guessing the simple past and the past participle of an English irregular verb shown in simple present. At every stage you will see a random English verb, and you can guess the related simple past and past participle by clicking on the correct answer

Spanish Verb Prepositions Quiz

The quiz consists of guessing the correct prepositions for a Spanish verb. At every stage you will see a random Spanish verb, and you can guess the correct preposition (or select "no preposition" if the verb does not want a preposition) by clicking on the correct button. If the verb could be combined with more than one preposition the number of correct answers is shown in brackets at the end of the question

Italian articles quiz (free)

The quiz consists of guessing the article of an Italian word. At every stage you will see a random Italian noun, and you can guess its article by clicking on the 4 buttons corresponding to the 4 singular determinative articles (il,lo,la,l').

About

An android library project to use for different types of multiple-answer quiz applications. In particular the templates provides 2 kind of quiz mode (educational games or trivia), a quiz domain model and logic and a lot of extensible UI elements.