Java tutorial
//package com.java2s; //License from project: Open Source License import android.view.View; import android.view.ViewGroup; public class Main { public static View findViewByClassName(ViewGroup v, String viewClassName) { View a; for (int i = 0; i < v.getChildCount(); i++) { a = v.getChildAt(i); if (a.getClass().getName().equals(viewClassName)) return a; if (ViewGroup.class.isAssignableFrom(a.getClass())) { View b = findViewByClassName((ViewGroup) a, viewClassName); if (b != null) return b; } } return null; } }