Java tutorial
//package com.java2s; //License from project: Apache License import android.view.View; import android.view.ViewGroup; public class Main { private static int calculateParallaxLayersRecursively(View view, int startCount) { int count = startCount; 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; } }