net.neurowork.mobile.android.fw.levels.impl
Class QuizController

java.lang.Object
  extended by net.neurowork.mobile.android.fw.levels.impl.QuizController

public class QuizController
extends java.lang.Object


Constructor Summary
QuizController()
           
 
Method Summary
 void addQuiz(QuizLevelDataItem quiz)
           
 void finish()
          Call this method for finish the quiz.
 java.util.List<java.lang.String> getAnswers()
          Return a list of String with answers of actual question
 java.lang.String getImage()
          Return the actual question image
 java.lang.String getQuestion()
          Return the actual question
 Results getResult()
          Return the actual quiz results.
 boolean hasNext()
          Return if there is more questions available.
 void next()
          Skips to the next quiz question and confirms your last answer set with setAnswer() method.
 void setAnswer(int index)
          Set the answer for the actual question with his index.
 void start(int time)
          Starts the quiz.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuizController

public QuizController()
Method Detail

addQuiz

public void addQuiz(QuizLevelDataItem quiz)

start

public void start(int time)
Starts the quiz. Must be called before start your quiz. Then you can call other methods like getQuestion for get the actual question.

Parameters:
time - Time for make the quiz, in seconds

hasNext

public boolean hasNext()
Return if there is more questions available. If not, you should call finish() method for finish the quiz and confirm the last answer.

Returns:
True if there are more questions. False if the actual question is the last one

next

public void next()
Skips to the next quiz question and confirms your last answer set with setAnswer() method. You should be call this method after checking with hasNext method. If the quiz is an adventure, you must use setAnswer before call this method.


getQuestion

public java.lang.String getQuestion()
Return the actual question

Returns:

getImage

public java.lang.String getImage()
Return the actual question image

Returns:
The path or url of the image.

getAnswers

public java.util.List<java.lang.String> getAnswers()
Return a list of String with answers of actual question

Returns:

setAnswer

public void setAnswer(int index)
Set the answer for the actual question with his index. You must call this method before call next() if your quiz is an adventure. For confirm your answer you have to call next() method later.

Parameters:
index - Answer index from 0 to getAnswers().size()-1;

getResult

public Results getResult()
Return the actual quiz results. You can call this method anytime.

Returns:

finish

public void finish()
Call this method for finish the quiz. It's needed to confirm the last answer which you set with setAnswer method.