Java tutorial
//package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { private static int calculateParallaxLayersRecursively(View view, int count) { if (view instanceof ViewGroup) { ViewGroup group = (ViewGroup) view; for (int i = 0; i < group.getChildCount(); i++) { count = calculateParallaxLayersRecursively(group.getChildAt(i), count); } } else { count++; } return count; } }