public final int childItemPosition ( int childAdapterPosition ) { int itemCount = 0 ; int parentCount = parentItemCount ( ) ; for ( int i = 0 ; i < parentCount ; i ++ ) { itemCount += 1 ; if ( isExpanded ( i ) ) { int childCount = childItemCount ( i ) ; itemCount += childCount ; if ( childAdapterPosition < itemCount ) { return childCount - ( itemCount - childAdapterPosition ) ; } } else { // itemCount += 1; } } throw new IllegalStateException ( "The adapter position is invalid: " + childAdapterPosition ) ; }
Get the position of the child item from the adapter position .