Fix app crash on boolean questions
Fixed a bug which caused an app crash if the user picked the wrong answer on a boolean question. Based on #4.
This commit is contained in:
parent
b8d399e144
commit
007122e4b0
|
@ -43,7 +43,7 @@ import com.luca0n.joguitos.pluck.R;
|
||||||
import com.luca0n.joguitos.pluck.activities.TriviaGameActivity;
|
import com.luca0n.joguitos.pluck.activities.TriviaGameActivity;
|
||||||
import com.luca0n.joguitos.pluck.trivia.TriviaQuestion;
|
import com.luca0n.joguitos.pluck.trivia.TriviaQuestion;
|
||||||
import com.luca0n.joguitos.pluck.trivia.TriviaQuestionMultiple;
|
import com.luca0n.joguitos.pluck.trivia.TriviaQuestionMultiple;
|
||||||
|
import com.luca0n.joguitos.pluck.trivia.TriviaQuestionBoolean;
|
||||||
|
|
||||||
public class TriviaQuestionFragment extends Fragment {
|
public class TriviaQuestionFragment extends Fragment {
|
||||||
|
|
||||||
|
@ -114,6 +114,9 @@ public class TriviaQuestionFragment extends Fragment {
|
||||||
} else {
|
} else {
|
||||||
buttonAnswerTrue.setOnClickListener(listener);
|
buttonAnswerTrue.setOnClickListener(listener);
|
||||||
buttonAnswerFalse.setOnClickListener(listener);
|
buttonAnswerFalse.setOnClickListener(listener);
|
||||||
|
|
||||||
|
boolean correctAnswer = ((TriviaQuestionBoolean) question).checkAnswer("true");
|
||||||
|
buttonAnswerCorrect = correctAnswer ? buttonAnswerTrue : buttonAnswerFalse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue