I've been trying to find a way to avoid having to manually assign components I've created in design mode to array variables, with no success. What I mean is, rather than having to do like this:
val myButtons = ArrayOf (bt0, bt1, bt2,bt3..bt30...
etc.
I'd like to know whether there's a way to iterate through all buttons (or ANY other component) created in the app and just call them by their class indexes, just like you can do in HTML:
button class = "buttons"
This way, in HTML, I can create and manipulate as many buttons as I want using JavaScript/jQuery just by using getElementByClassName
or $(". buttons")
respectively.
Even in old good VisualBasic 6 times, whenever I copied a component and pasted its copy, VB would ask me whether an array of those components should be created and if so, it would assign an index to each one of the new components pasted. This way I could manipulate all of them programmatically with for/each loops or by their indexes individually. Is it impossible to do that in Android Studio (I'm using Kotlin, but I'd gladly shift to Java if it's a language support limitation) and is manually assigning each element at a time to an array variable really the only option that there is? I really hope not...
Thanks in advance!