Android Question using a variable to access a view

clydebamford

Member
Licensed User
Longtime User
I have many checkbox views in designer that I would like to access with code and it would be trivial if I could use a variable in a for loop to change their text color or similar property
ie cb1, cb2, cb3 could be accessed easily in a for loop rather than repeating the code addnausium for each checkbox, does that make sense?
 

DonManfred

Expert
Licensed User
Longtime User
put the objects into a list after you loaded the layout.
This has discussed a lot of times in forum. Try the forumsearch
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Add the views to a list if you are adding them in the designer or if you are adding them in code, just array them

B4X:
 dim checkbox(10) as checkbox

For n = 0 to checkbox ().lenght -1
Checkbox(n).checked = False
Next
 
Upvote 0
Top