Android examples for User Interface:AdapterView
Get Adapter View from View
//package com.java2s; import android.util.SparseArray; import android.view.View; public class Main { @SuppressWarnings("unchecked") public static <T extends View> T getAdapterView(View convertView, int id) { SparseArray<View> viewHolder = (SparseArray<View>) convertView .getTag();/*from w w w . j a va 2 s. c o m*/ if (viewHolder == null) { viewHolder = new SparseArray<View>(); convertView.setTag(viewHolder); } View childView = viewHolder.get(id); if (childView == null) { childView = convertView.findViewById(id); viewHolder.put(id, childView); } return (T) childView; } }