bindChildView 和 bindGroupView 相同的光标

bindChildView and bindGroupView same cursor

使用 getChildrenCursor 如何使 bindChildView 接收与 bindGroupView 相同的光标?

        @Override
        protected Cursor getChildrenCursor(Cursor groupCursor) {


            Cursor childCursor = groupCursor;//bd.ReadData("select * from images where _id="+2);


            return childCursor;
        }

这样returns所有组的光标,而不是特定于一个组...

通过获取 GroupId 能够为每个 child 查询正确的行,如下所示

        @Override
        protected Cursor getChildrenCursor(Cursor groupCursor) {

            int groupPos = groupCursor.getPosition();
            int groupId = groupCursor.getInt(groupCursor.getColumnIndex("_id"));
            Log.d("data","Show data groupPos->" + groupPos + "ID->" + groupId);

            Cursor childCursor = bd.ReadData("select * from images where _id="+groupId);

            return childCursor;

        }

        @Override
        public int getChildrenCount(int groupPosition) {
            return 1;
        }