Java tutorial
//package com.java2s; //License from project: Apache License import android.view.View; import android.view.ViewGroup; import java.util.List; public class Main { /** * Helps to find recursivly all visible childs in a view group. * * @param viewGroup View group. * @param ordoredChilds Childs list where visible childs will be added. */ static void findAllVisibleChilds(final ViewGroup viewGroup, final List<View> ordoredChilds) { for (int childViewIndex = 0; childViewIndex < viewGroup.getChildCount(); childViewIndex++) { final View childView = viewGroup.getChildAt(childViewIndex); if (childView instanceof ViewGroup) { findAllVisibleChilds((ViewGroup) childView, ordoredChilds); continue; } if (childView.getVisibility() == View.VISIBLE) { ordoredChilds.add(childView); } } } }