Android ViewGroup Get getSubviewsTree(ViewGroup parentView, Class classOfSubviews, ArrayList result)

Here you can find the source of getSubviewsTree(ViewGroup parentView, Class classOfSubviews, ArrayList result)

Description

get Subviews Tree

Declaration

static void getSubviewsTree(ViewGroup parentView,
            Class<?> classOfSubviews, ArrayList<View> result) 

Method Source Code

//package com.java2s;
import java.util.ArrayList;

import android.view.View;
import android.view.ViewGroup;

public class Main {
    static void getSubviewsTree(ViewGroup parentView,
            Class<?> classOfSubviews, ArrayList<View> result) {
        for (int i = 0; i < parentView.getChildCount(); i++) {
            View child = parentView.getChildAt(i);
            if (classOfSubviews.isAssignableFrom(child.getClass()))
                result.add(child);/* www  . jav a 2  s . c o m*/
            if (child instanceof ViewGroup)
                getSubviewsTree((ViewGroup) child, classOfSubviews, result);
        }
    }

    public static ArrayList<View> getSubviewsTree(ViewGroup parentView,
            Class<?> classOfSubviews) {
        ArrayList<View> result = new ArrayList<View>();
        getSubviewsTree(parentView, classOfSubviews, result);
        return result;
    }
}

Related

  1. getSubviewsTree(ViewGroup parentView, Class classOfSubviews)