2012-10-22 53 views
0

我有一个奇怪的错误。我使用这个http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/创建了一个使用另一个列表视图的标题的列表视图。我用直数组填充标题列表(没有那么多),并从已有的数据库填充项目列表视图。 这两个列表视图都显示正常,并且项目点击进入相关选项,但列表上的条目来自搜索参数之外。列表视图中的sqlite数据库的随机条目?

这是从返回列表中的类:

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; 
} 

提前非常感谢。

回答

0

好吧,我解决了它。 SQLite似乎并没有将整数值视为Integer值,所以它将id 1混合在id 9和10之间,依此类推。我创建了另一列来定义这些部分。

相关问题