I just started learning Kotlin and I don't know to use when properly. When number is 1, the toast is there, but the image (the second 1 case) is not changed. Is there a way to do this with when?
when (number){
1 -> Toast.makeText(applicationContext,"1",Toast.LENGTH_SHORT).show()
1 -> imgview.setImageResource(R.drawable.dice_1)
2 -> Toast.makeText(applicationContext,"SAD",Toast.LENGTH_SHORT).show()
2 -> imgview.setImageResource(R.drawable.dice_2)
}