在 Android 2.2 mContext=context (或我放在那里的任何其他内容)上,永远不会被调用。它确实适用于2.3+。这是一个已知问题吗?有解决方法吗?
public class ExpListCursorAdapter extends SimpleCursorTreeAdapter {
Context mContext;
public ExpListCursorAdapter(Context context, Cursor cursor,
int groupLayout, String[] groupFrom, int[] groupTo,
int childLayout, String[] childFrom, int[] childTo) {
super(context, cursor, groupLayout, groupFrom, groupTo, childLayout, childFrom,
childTo);
mContext=context;
}
@Override
protected Cursor getChildrenCursor(Cursor groupCursor) {
int id=groupCursor.getInt(DatabasePazienti.ROWID);
DatabaseTests mDbTests=new DatabaseTests(mContext);
mDbTests.open();
Cursor cursor=mDbTests.fetchPatientTests(id);
return cursor;
}