Usage of _id is not clear enough in my mind. Considering all possible actions(onChildClick,onItemClick,onExpand,onCollapse etc. or even drawings) on ExpandableListView below;
=A==============
-B-----------
-C-----------
=D==============
-E-----------
-B----------- //Note: B is included in both groups
is it OK to use same _id values with CursorTreeAdapter on following relations:
- B with C (this is problem I know)
- A with D (this is problem too, I know)
- A with B (this is what I am confused)
- E with C (also this one confuses me)
- E with B (possible problem)
- C with D (OK, I guess)
The
_idsimply has to be unique for any given category. In other words the parents (groups) must have a unique_idfrom each other and each individual child within a particular group should have a unique_idfrom each other but it doesn't matter if any have the same_idas a parent.Using your example, groups A & D should not have the same
_id.In group A, children B & C should not have the same
_idas each other but if one of them has the same_idas group A or group D then it doesn't matter.In group D, children E & B should not have the same
_idand, again, if one of them has the same_idas group A or group D this also doesn't matter.Finally, child B in both groups can (and probably will) have the same
_idin both instances.In short, the
CursorTreeAdapterrequires a singleCursorfor the groups and multiple separateCursorsfor each set of children. None of these are directly related and each are self-contained.