Reputation: 6656
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:
Upvotes: 1
Views: 141
Reputation: 48871
The _id
simply has to be unique for any given category. In other words the parents (groups) must have a unique _id
from each other and each individual child within a particular group should have a unique _id
from each other but it doesn't matter if any have the same _id
as 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 _id
as each other but if one of them has the same _id
as group A or group D then it doesn't matter.
In group D, children E & B should not have the same _id
and, again, if one of them has the same _id
as group A or group D this also doesn't matter.
Finally, child B in both groups can (and probably will) have the same _id
in both instances.
In short, the CursorTreeAdapter
requires a single Cursor
for the groups and multiple separate Cursors
for each set of children. None of these are directly related and each are self-contained.
Upvotes: 0