get Immediate Children View - Android User Interface

Android examples for User Interface:View Child

Description

get Immediate Children View

Demo Code


//package com.java2s;

import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<View> getImmediateChildren(ViewGroup parent) {
        List<View> views = new ArrayList<View>();
        for (int i = 0; i < parent.getChildCount(); i++) {
            views.add(parent.getChildAt(i));
        }//from w w  w . j  a v  a2 s.  c  o  m
        return views;
    }
}

Related Tutorials