Code example for SparseArray

Methods: get, put

0
    public abstract View getItemView(int section, int position, View convertView, ViewGroup parent);
 
    public abstract View getSectionHeaderView(int section, View convertView, ViewGroup parent);
 
    private int internalGetCountForSection(int section) {
        Integer cachedSectionCount = mSectionCountCache.get(section);
        if (cachedSectionCount != null) {
            return cachedSectionCount;
        } 
        int sectionCount = getCountForSection(section);
        mSectionCountCache.put(section, sectionCount);
        return sectionCount;
    } 
 
    private int internalGetSectionCount() { 
        if (mSectionCount >= 0) {
            return mSectionCount;
        } 
        mSectionCount = getSectionCount();
        return mSectionCount;
    }