glassraven glassraven - 1 year ago 62
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?

Answer Source
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download