I am making a simple memory game. It basically, some ImageView come up and after that user should click ImageView according to order. However, ImageView can also be clickable while sorting.
So, I want the ImageViewto be non-clickable while sorting is not finish and then I want ImageViewcan be clickable when the sorting is finished. How can I do that?
-edit 1
After your solutions, i tried image.setEnable = false method in kotlin and i have the result.
here related section
kotlin
fun orderImages() {
index=0
Collections.shuffle(controlArray)
println(controlArray)
runnable = object : Runnable {
override fun run() {
for (image in imageArray) {
image.visibility = View.INVISIBLE
image.isEnabled = false
}
if (index < controlArray.size) {
imageArray[controlArray[index]].visibility = View.VISIBLE
index++
} else {
handler.removeCallbacks(runnable)
for (image in imageArray) {
image.visibility = View.VISIBLE
image.isEnabled = true
}
}
handler.postDelayed(runnable, 1000)
}
}
handler.post(runnable)
userArray.clear()
}