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;

public class Main {
    private static View getFirstChildByClassName(ViewGroup parent, String name) {
        View retView = null;
        int childCount = parent.getChildCount();

        for (int childIndex = 0; childIndex < childCount; childIndex++) {
            View child = parent.getChildAt(childIndex);

            if (child.getClass().getName().equals(name)) {
                return child;
            }

            if (child instanceof ViewGroup) {
                View v = getFirstChildByClassName((ViewGroup) child, name);

                if (v != null) {
                    return v;
                }
            }
        }

        return retView;
    }
}