I’m currently using a CursorTreeAdapter to map a Curser to an ExpandableListView in Android.
Everything works fine except from the way data is handled inside the ListView. Generally all the data is already inside the Cursor I give the Constructor of the CursorTreeAdater – even the daa for the Childview. The Problem is Android expects the data for the ChildView to be received by the getChildrenCursor function:
@Override
protected Cursor getChildrenCursor(Cursor groupCursor) {
db.open();
return db.getEpisode(groupCursor.getString(0));
}
Here you already see the Problem. I have to return a cursor but I’m not able to just “Cut out” the one entry in the Cursor that is responsible for the specific Childview. Instead I came up with something like querying the database for every single ChildView there is. This is not only dumb since the data is already there (inside the groupcursor) but it also ist pretty slow.
My Question would be if there is some kind of functionality of cloning only specific entries of cursors or returning only one entry instead of constantly querying the database.
Maybe I’m also off by using the CursorTreeAdapter and using a more general AdapterClass would be beneficial.
Thank you all,
Johannes
I currently figured it our myself.
The answer was to switch from a CursorTreeAdapter to a BaseExpandableListAdapter
I somehow was scared before (dunno why) but now its working like a charm.
If someone is interested in the code I can post it here. Just leave a comment