开发者

SimpleCursorTreeAdapter for ExpandableListView

How does the cursor nee开发者_开发百科d to be formatted so that so that I get categories and their children to display correctly. How will the adapter discern between what are categories and what are children?


The initial Cursor just needs the parent items. Here I usually use a Cursor that gives me distinct values.

You need to extend SimpleCursorTreeAdapter and overwrite getChildrenCursor(). Here I use the selected distinct value to return a Cursor that contains all rows of that type.

Simply said, you need a cursor for the parent value and one for every child. Most of the time the child cursor is the same with a where clause for the selected parent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜