Returns an array with the direct children of the parent ViewGroup - Android User Interface

Android examples for User Interface:ViewGroup

Description

Returns an array with the direct children of the parent ViewGroup

Demo Code


//package com.java2s;

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

public class Main {
    /** Returns an array with the direct children of the parent ViewGroup **/
    public static View[] directChildViews(ViewGroup parent) {
        int childCount = parent.getChildCount();
        View[] arr = new View[childCount];
        for (int i = 0; i < childCount; i++) {
            arr[i] = parent.getChildAt(i);
        }/*from www. j  a v  a 2  s .  c om*/
        return arr;
    }
}

Related Tutorials