-
-
Save codeforfun-jp/c0964e3df52ebe03ae7ed3f27fc3d431 to your computer and use it in GitHub Desktop.
Android Quiz App Kotlin 4-4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun showNextQuiz() { | |
// クイズを1問取り出す | |
val quiz = quizData[0] | |
// 問題をセット | |
binding.questionLabel.text = quiz[0] | |
// 正解をセット | |
rightAnswer = quiz[1] | |
// 都道府県名を削除 | |
quiz.removeAt(0) | |
// 正解と選択肢3つをシャッフル | |
quiz.shuffle() | |
// 正解と選択肢をセット | |
binding.answerBtn1.text = quiz[0] | |
binding.answerBtn2.text = quiz[1] | |
binding.answerBtn3.text = quiz[2] | |
binding.answerBtn4.text = quiz[3] | |
// 出題したクイズを削除する | |
quizData.removeAt(0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment