private void setUpQuestions() { if (index == questions.size()) { Log.d("Questionare", "Ended All the Questions"); endGame(); } else { currentQuestion = questions.get(index); lblQuestion.setText(currentQuestion.getQuestion()); imgPicture.setImageResource(currentQuestion.getPicture()); index++; } }
private void determineButtonPress(boolean answer) { boolean expectedAnswer = currentQuestion.isAnswer(); if (answer == expectedAnswer) { // you were right Toast.makeText(MainActivity.this, "Correct!", Toast.LENGTH_SHORT).show(); score++; } else { // you were wrong Toast.makeText(MainActivity.this, "Wrong!", Toast.LENGTH_SHORT).show(); } setUpQuestions(); }