I've got a wierd bug. I have created a listview with headings using another listview using this http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/ . Ive populated the headings list with a straight array (there aren't that many) and populated the items listview from a preexisting database. Both listviews show up fine and the items click through to the relevent selections ok, but there are entries on the list from outside the search parameters .
This is from the class that returns the lists:
private Cursor getBeginnersCursor()
{
this.cursor = null;
try{
this.getmDB();
if(this.mDB == null)
{
System.out.println("mDB = null");
}
this.cursor = mDB.query(TABLE_NAME,new String[]{KEY_ID,GAME_NAME}, "_id > 11 AND _id < 35",
null,null,null,null);
if(this.cursor != null)
{
this.cursor.moveToNext();
}
mDB.close();
return this.cursor;
}catch(SQLException e){
throw e;
}
}
private List<String> getBeginnersArrayList()
{
this.getmDB();
this.cursor = this.getBeginnersCursor();
String result;
for(this.cursor.moveToFirst(); !this.cursor.isAfterLast();this.cursor.moveToNext())
{
result = this.cursor.getString(1) + "\n";
this.beginnersArrayList.add(result);
}
this.cursor.close();
return beginnersArrayList;
}
Many thanks in advance.
Ok I worked it out. SQLite doesnt seem to treat text integer values the same as Integer values, so it was mixing the id 1 in between id's 9 and 10 and so on. Ive created another column to define the sections instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.