Code example for SparseIntArray

Methods: clear

     * Information about where these groups are located in the list, how large they are 
     * and whether they are expanded. 
    private long[] mGroupMetadata;
    private SparseIntArray mPositionCache = new SparseIntArray();
    private int mLastCachedListPosition;
    private int mLastCachedCursorPosition;
    private int mLastCachedGroup;
     * A reusable temporary instance of PositionMetadata 
    private PositionMetadata mPositionMetadata = new PositionMetadata();
    protected boolean mDataValid;
    protected ChangeObserver mChangeObserver;
    protected DataSetObserver mDataSetObserver = new MyDataSetObserver();
    public GroupingListAdapter(Context context) {
        mContext = context;
        mChangeObserver = new ChangeObserver();
     * Finds all groups of adjacent items in the cursor and calls {@link #addGroup} for 
     * each of them. 
    protected abstract void addGroups(Cursor cursor);
    protected abstract View newStandAloneView(Context context, ViewGroup parent);
    protected abstract void bindStandAloneView(View view, Context context, Cursor cursor);
    protected abstract View newGroupView(Context context, ViewGroup parent);
    protected abstract void bindGroupView(View view, Context context, Cursor cursor, int groupSize,
            boolean expanded);
    protected abstract View newChildView(Context context, ViewGroup parent);
    protected abstract void bindChildView(View view, Context context, Cursor cursor);
     * Cache should be reset whenever the cursor changes or groups are expanded or collapsed. 
    private void resetCache() { 
        mCount = -1;
        mLastCachedListPosition = -1;
        mLastCachedCursorPosition = -1;
        mLastCachedGroup = -1;
        mPositionMetadata.listPosition = -1;
    protected void onContentChanged() { 
    	if (mCursor != null && !mCursor.isClosed()) {
    		mDataValid = mCursor.requery();