Beispiel #1
0
        public virtual object getItem(int position)
        {
            // Header (negative positions will throw an ArrayIndexOutOfBoundsException)
            int numHeaders = getHeadersCount();

            if (position < numHeaders)
            {
                return(mHeaderViewInfos.get(position).data);
            }
            // Adapter
            int adjPosition  = position - numHeaders;
            int adapterCount = 0;

            if (mAdapter != null)
            {
                adapterCount = mAdapter.getCount();
                if (adjPosition < adapterCount)
                {
                    return(mAdapter.getItem(adjPosition));
                }
            }
            // Footer (off-limits positions will throw an ArrayIndexOutOfBoundsException)
            return(mFooterViewInfos.get(adjPosition - adapterCount).data);
        }