开发者

SimpleCursorTreeAdapter for ExpandableListView

开发者 https://www.devze.com 2023-02-28 06:51 出处:网络
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

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

精彩评论

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