I am using an expandable list view . When i click on a parent , it displays the child information properly . However , when I scroll downwards with my child still collapsed , I get an error -bad request for field slot 0,-1 numrows=3 numcolumns=3 . When I scroll up , there is no problem .Or if my child is not collapsed , then there is no problem in scrolling anywhere.
MY code for simplecursortree adapter :-
Cursor cursor = db.rawQuery("SELECT _id,words from keywords", null);
startManagingCursor(cursor);
SimpleCursorTreeAdapter mAdapter = new SimpleCursorTreeAdapter(TestActivity.this,
cursor, R.layout.exprow,
new String[] { DbHandler.D_WORDS}, new int[] { R.id.textText},
R.layout.row,new String[] {DbHandler.C_STATUS,DbHandler.C_CREATED_AT,DbHandler.C_USER}, new int[] {R.id.textStatus,R.id.textCreatedAt,R.id.textUser}) {
@Override
protected Cursor getChildrenCursor(Cursor groupCursor) {
dbhandler=new DbHandler(TestActivity.this);
SQLiteDatabase db = dbhandler.getReadableDatabase();
String get=groupCursor.getString(1);
Log.d("Post Operation", "Getting cursor for keyword = " +get);
String sql="SELECT status,created_at,user from tweets where words='"+get+"'" ;
Cursor cursor = db.rawQuery(sql, null);
startManagingCursor(cursor);
Log.d("TestActivity","Cursor got count"+cursor.getCount());
db.close();
return cursor;
}
};
I solved this by adding an _id in my sql query inside getChildrenCursor . I thought the _id just has to be present in the table .