findViewById with variable
Hi,
i am very new at Android/Kotlin development and I have a very simple question.
I try to use the “findViewById” expression in combination with a variable. x is a number and counted up.
Here is my snippet:
var my_element = "dot"+x
round = findViewById(R.id.my_element)
But it doesnt work.
How can I use a dynamic expression in the “findViewById”-function?
Thank you!
1 post - 1 participant
<a href="https://discuss.kotlinlang.org/t/findviewbyid-with-variable/26344">Read...