public int getExpandedItemsCount ( int from , int position ) { int totalAddedItems = 0 ; //first we find out how many items were added in total //also counting subItems Item tmp ; for ( int i = from ; i < position ; i ++ ) { tmp = mFastAdapter . getItem ( i ) ; if ( tmp instanceof IExpandable ) { IExpandable tmpExpandable = ( ( IExpandable ) tmp ) ; if ( tmpExpandable . getSubItems ( ) != null && tmpExpandable . isExpanded ( ) ) { totalAddedItems = totalAddedItems + tmpExpandable . getSubItems ( ) . size ( ) ; } } } return totalAddedItems ; }
calculates the count of expandable items before a given position