glassraven glassraven - 2 months ago 12
Android Question

How to set the same property (invisibility) to several elements with a loop?

I have several elements that i want to set with the same property. Is it possible with a for loop? Thanks in advance. This is what I have so far:

public void invisible(){
int[] buttons = {,,,,,,
for(int i=0; i<buttons.length; i++){
//set invisible?

for (int i = 0; i < buttons.length; i++) {

This should work. You iterate over the view ids, search for the view in your layout hierachy and set the visibility.