yes, getChildCount (), works in a ViewGroup, e.g. LinearLayout, RelativeLayout, etc.
ViewGroup add_phone = (ViewGroup) getLayoutInflater().inflate(R.layout.phone_info, null); int childCount = add_phone.getChildCount();
you must make sure that the bloated layout has viewGroup as the parent view, otherwise you will get a class exception. viewGroup can be like LinearLayout, RelativeLayout, etc.
Yashwanth kumar
source share