I'm making a quiz app and while my Toast Method worked the first time I ran it, it's not now that I've changed some of the code. It now tells me that it cannot resolve the Toast Method. I'm not sure what I am missing. Any help would be greatly appreciated.
submit = (Button) findViewById(R.id.score);
submit.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
int correctAnswers = 0;
if (q1.isChecked()) {
correctAnswers += 1;
}
if (q2Box1.isChecked() || q2Box3.isChecked()) {
correctAnswers += 1;
}
if (q3.isChecked()) {
correctAnswers += 1;
}
if (q5.isChecked()) {
correctAnswers += 1;
}
String q4Text = q4.getText().toString();
if (q4Text.equals(String.valueOf(correctAnswers))) {
correctAnswers += 1;
}
// Show score message as a toast
Toast.makeText(this, "You got " + correctAnswers + "/5 correct!", Toast.LENGTH_LONG).show();
// Exit this method early because there's nothing left to do
return;
}
});}}