/** * Converts a child position to a flat list position. * * @param packedPosition The child positions to be converted in it's * packed position representation. * @return The flat list position for the given child */ public int getFlattenedChildIndex(long packedPosition) { ExpandableListPosition listPosition = ExpandableListPosition.obtainPosition(packedPosition); return getFlattenedChildIndex(listPosition); }
/** * @return list of indexes of all checked child items */ public List<Integer> getCheckedPositions() { List<Integer> selected = new ArrayList<>(); for (int i = 0; i < expandableList.groups.size(); i++) { if (expandableList.groups.get(i) instanceof CheckedExpandableGroup) { CheckedExpandableGroup group = (CheckedExpandableGroup) expandableList.groups.get(i); for (int j = 0; j < group.getItemCount(); j++) { if (group.isChildChecked(j)) { long packedPosition = ExpandableListView.getPackedPositionForChild(i, j); selected.add(expandableList.getFlattenedChildIndex(packedPosition)); } } } } return selected; }