diff --git a/DiceRoller/app/src/main/java/com/example/diceroller/MainActivity.kt b/DiceRoller/app/src/main/java/com/example/diceroller/MainActivity.kt index 0bc619a..688a059 100755 --- a/DiceRoller/app/src/main/java/com/example/diceroller/MainActivity.kt +++ b/DiceRoller/app/src/main/java/com/example/diceroller/MainActivity.kt @@ -53,19 +53,21 @@ class MainActivity : AppCompatActivity() { // Find the ImageView in the layout val diceImage: ImageView = findViewById(R.id.imageView) + + // Update the ImageView with the correct drawable resource ID + diceImage.setImageResource( - // Determine which drawable resource ID to use based on the dice roll - val drawableResource = when (diceRoll) { - 1 -> R.drawable.dice_1 - 2 -> R.drawable.dice_2 - 3 -> R.drawable.dice_3 - 4 -> R.drawable.dice_4 - 5 -> R.drawable.dice_5 - else -> R.drawable.dice_6 - } + // Determine which drawable resource ID to use based on the dice roll + when (diceRoll) { + 1 -> R.drawable.dice_1 + 2 -> R.drawable.dice_2 + 3 -> R.drawable.dice_3 + 4 -> R.drawable.dice_4 + 5 -> R.drawable.dice_5 + else -> R.drawable.dice_6 + } - // Update the ImageView with the correct drawable resource ID - diceImage.setImageResource(drawableResource) + ) // Update the content description diceImage.contentDescription = diceRoll.toString()