Android examples for User Interface:View Tag
get First View By Tag
//package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { public static View getFirstViewByTag(View root, Object tag) { View result = null;//from ww w . ja v a2s . c o m if (root != null) { result = root.findViewWithTag(tag); if (result == null && root instanceof ViewGroup) { ViewGroup groupView = (ViewGroup) root; final int childCount = groupView.getChildCount(); for (int i = 0; i < childCount; i++) { result = getFirstViewByTag(groupView.getChildAt(i), tag); if (result != null) { break; } } } } return result; } }