使用getChildrenCursor
如何使bindChildView
获得与bindGroupView
相同的光标?
@Override
protected Cursor getChildrenCursor(Cursor groupCursor) {
Cursor childCursor = groupCursor;//bd.ReadData("select * from images where _id="+2);
return childCursor;
}
这种方式返回所有组的Cursor,而不是特定于一个Group ...
答案 0 :(得分:0)
通过让GroupId能够为每个孩子查询正确的行,如下所示
@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;
}