开发者

Automate findViewById to get an array of widgets

开发者 https://www.devze.com 2023-04-03 19:20 出处:网络
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 co

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消