Azienda coinvolta
HackerRank.com - Android: Implement findViewById method given that View extends ViewGroup (use recursion)
Anonimo
public View findViewById(int id) { View currentView = getView(); if (currentView.getId == id) { return currentView; } if (!currentView instanceof ViewGroup){ return null; } // this mean currentView instance of view group , mean has child int childCount = currentView.getChildCount(); if (childCount < 1) return null; for (int i = 0; i < childCount; i++) { View childView = currentView.getChildAt(i); return childView.findViewById(id); } }