Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

import java.util.List;

public class Main {

    public static void findAllViews(ViewGroup parent, List<View> views, Class type) {
        for (int i = 0; i < parent.getChildCount(); i++) {
            View child = parent.getChildAt(i);
            if (child instanceof ViewGroup && child.getClass() != type) {
                findAllViews((ViewGroup) child, views, type);
            } else if (child != null) {
                if (child.getClass() == type) {
                    views.add(child);
                }
            }
        }
    }
}