if (view == null || !(view instanceof ViewGroup))
return;
Stack m = new Stack<>();
while (view != null) {
ViewGroup tmpGroup = (ViewGroup) view;
int count = tmpGroup.getChildCount();
for (int i = 0; i < count; i++) {
View child = tmpGroup.getChildAt(i);
if (child instanceof ViewGroup) m.add(child);
else if (child instanceof Button) { child.setBackgroundColor(color);
} }
if (m.isEmpty()) break;
else view = m.pop();
}
}
return;
Stack m = new Stack<>();
while (view != null) {
ViewGroup tmpGroup = (ViewGroup) view;
int count = tmpGroup.getChildCount();
for (int i = 0; i < count; i++) {
View child = tmpGroup.getChildAt(i);
if (child instanceof ViewGroup) m.add(child);
else if (child instanceof Button) { child.setBackgroundColor(color);
} }
if (m.isEmpty()) break;
else view = m.pop();
}
}