Skip to content

Instantly share code, notes, and snippets.

@codeforfun-jp
Created November 5, 2024 05:52
Show Gist options
  • Save codeforfun-jp/c93d691c032a7c49e2cc5d746f454405 to your computer and use it in GitHub Desktop.
Save codeforfun-jp/c93d691c032a7c49e2cc5d746f454405 to your computer and use it in GitHub Desktop.
[Java Quiz ver2] 4-1
protected void onCreate(Bundle savedInstanceState) {
/* 省略 */
}
private void showNextQuiz() {
// クイズカウントラベルを更新
binding.countLabel.setText(getString(R.string.count_label, quizCount));
// quizArrayからクイズを1つ取り出す
ArrayList<String> quiz = quizArray.get(0);
// 問題文(都道府県名)を表示
binding.questionLabel.setText(quiz.get(0));
// 正解をrightAnswerにセット
rightAnswer = quiz.get(1);
// 解答ボタンに正解と選択肢3つを表示
binding.answerBtn1.setText(quiz.get(1));
binding.answerBtn2.setText(quiz.get(2));
binding.answerBtn3.setText(quiz.get(3));
binding.answerBtn4.setText(quiz.get(4));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment