Skip to content

Instantly share code, notes, and snippets.

@skooltch84
Created January 9, 2017 20:26
Show Gist options
  • Save skooltch84/256346a8c4d85b1bd2445b4e711ea7b8 to your computer and use it in GitHub Desktop.
Save skooltch84/256346a8c4d85b1bd2445b4e711ea7b8 to your computer and use it in GitHub Desktop.
Code for multiple choice button
//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
@98lr20
Copy link

98lr20 commented Feb 13, 2017

where is the "getNumberOfQuestions" involved in in other parts of the code as this is the only thing that shows an error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment