我为我的应用程序制作了一个按钮监听器,但它说其他是一个意外的令牌,但我不知道为什么。这是我的代码和其他的??????背后是意想不到的令牌,我希望有人可以帮助我:
//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() == mAnswerFrankrijk)
mScoreFrankrijk++;
updateScore(mScoreFrankrijk);
//perform check before you update the question
if (mQuestionNumber == QuestionLibrary.mQuestionsFrankrijk.length) {
Intent i = new Intent(QuizActivityFrankrijk.this, QuizResultaat.class);
Bundle bundle = new Bundle();
bundle.putInt("finalScore", mScoreFrankrijk);
i.putExtras(bundle);
QuizActivityFrankrijk.this.finish();
startActivity(i);
} else {
updateQuestion();
}
}
else {
if (mQuestionNumber == QuestionLibrary.mQuestionsFrankrijk.length) {
Intent i = new Intent(QuizActivityFrankrijk.this, QuizResultaat.class);
Bundle bundle = new Bundle();
bundle.putInt("finalScore", mScoreFrankrijk);
i.putExtras(bundle);
QuizActivityFrankrijk.this.finish();
startActivity(i);
} else {
updateQuestion();
}
}
});
//End of Button Listener for Button1
答案 0 :(得分:1)
你错过了{在这一行
if (mButtonChoice1.getText() == mAnswerFrankrijk)