Code example for ExpandableListView

Methods: getFlatListPosition

0
        if (isOutOfBounds(packedPosition)) {
            throw new IllegalStateException("position out of range for adapter!");
        } 
         
        final ExpandableListView elv = getExpandableListView();
        final int flPos = elv.getFlatListPosition(packedPosition); 
         
        if (convertView != null) {
            ((TextView) convertView).setText(getValueAtPosition(packedPosition));
            convertView.setId(flPos);
            return convertView;
        } 
 
        int desiredHeight = getHeightForPosition(flPos);
        return createView(packedPosition, flPos, parent, desiredHeight);
    } 
     
    /** 
     * Create a view for a group or child position. 
     *  
     * @param packedPosition The packed position (has type, group pos, and optionally child pos).