Automate findViewById to get an array of widgets
I'm working on a Sodoku a开发者_高级运维pp. And it has 81 text. I can use findViewById to get them manually but I'm too lazy and I prefer to have them all in an array. Is there any better way?
You could build up your view programmatically, rather than via an xml file, so that you can grab the instances of the items as you create them.
you can load them into an ArrayList. Or do like @Mayra says and create them programatically in your java.
but I'm too lazy
Im sorry, but if you're too lazy to think about other ways to solve your own challenges why should we be motivated help you?
精彩评论