Code example for SparseBooleanArray

0
        { 
            selectView(position, !mSelectedItemsIds.get(position));
        } 
 
        public void removeSelection() { 
            mSelectedItemsIds = new SparseBooleanArray();
            notifyDataSetChanged();
        } 
 
        public void selectView(int position, boolean value)
        { 
            if(value)
                mSelectedItemsIds.put(position, value);
            else 
                mSelectedItemsIds.delete(position);
             
            notifyDataSetChanged();
        } 
         
        public int getSelectedCount() { 
            return mSelectedItemsIds.size();// mSelectedCount;