Code example for ExpandableListView

Methods: getFlatListPosition

        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));
            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).