0

我有一个奇怪的错误。我使用这个http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/创建了一个带有标题的列表视图。我已经用一个直接数组(没有那么多)填充了标题列表,并从预先存在的数据库中填充了项目列表视图。两个列表视图都显示得很好,并且项目单击到相关选择正常,但是列表中有来自搜索参数之外的条目。

这是来自返回列表的类:

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

提前谢谢了。

4

1 回答 1

0

好的,我解决了。SQLite 似乎没有将文本整数值视为与整数值相同,因此它将 id 1 混合在 id 的 9 和 10 之间,依此类推。我创建了另一列来定义这些部分。

于 2012-10-24T11:47:47.923 回答