Created
January 9, 2017 20:26
-
-
Save skooltch84/256346a8c4d85b1bd2445b4e711ea7b8 to your computer and use it in GitHub Desktop.
Code for multiple choice button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Start of Button Listener for Button1 | |
mButtonChoice1.setOnClickListener(new View.OnClickListener(){ | |
@Override | |
public void onClick(View view){ | |
//My logic for Button goes in here | |
if (mButtonChoice1.getText() == mAnswer){ | |
mScore = mScore + 1; | |
updateScore(mScore); | |
Toast.makeText(QuizActivity.this, "correct", Toast.LENGTH_SHORT).show(); | |
if(mQuestionNumber == mQuestionLibrary.getNumberOfQuestions()){ | |
setContentView(R.layout.end_of_quiz); | |
}else { | |
updateQuestion(); | |
} | |
}else { | |
Toast.makeText(QuizActivity.this, "wrong", Toast.LENGTH_SHORT).show(); | |
if(mQuestionNumber == mQuestionLibrary.getNumberOfQuestions()){ | |
setContentView(R.layout.end_of_quiz); | |
}else { | |
updateQuestion(); | |
} | |
} | |
} | |
}); | |
//End of Button Listener for Button1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
where is the "getNumberOfQuestions" involved in in other parts of the code as this is the only thing that shows an error