You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public OnClickListener guessButtonListener = new OnClickListener() {
@Override
public void onClick(View v) {
Button guessButton = ((Button) v);
String guess = guessButton.getText().toString();
String answer = getCountryName(correctAnswer);
++totalGuesses; // increment number of guesses the user has made
if (guess.equals(answer)) { // if the guess is correct
++correctAnswers; // increment the number of correct answers
// display correct answer in green text
answerTextView.setText(answer);
disableButtons(); // disable all guess Buttons
// if the user has correctly identified FLAGS_IN_QUIZ flags
if (correctAnswers == FLAGS_IN_QUIZ) {
// DialogFragment to display quiz stats and start new quiz
DialogFragment quizResults =
new DialogFragment() {
// create an AlertDialog and return it
@Override
public Dialog onCreateDialog(Bundle bundle) {
AlertDialog.Builder builder =
new AlertDialog.Builder(getActivity());
builder.setMessage(
getString(R.string.results,
totalGuesses,
(1000 / (double) totalGuesses)));
// "Reset Quiz" Button
builder.setPositiveButton(R.string.reset_quiz,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
resetQuiz();
}
}
);
return builder.create(); // return the AlertDialog
}
};
The text was updated successfully, but these errors were encountered:
public OnClickListener guessButtonListener = new OnClickListener() {
The text was updated successfully, but these errors were encountered: