光标超出范围:请求索引0,大小为0错误

时间:2017-10-26 09:00:45

标签: android

 public static boolean setHighscore(String column, int newScore) {
    boolean result = false;
    String[] col = {column};
    Cursor cursor = database.query(MySQLiteHelper.TABLE_HIGHSCORES, col, null, null, null, null, null);
    cursor.moveToFirst();
    int oldScore = cursor.getInt(0);
    if (newScore > oldScore) {
        ContentValues cv = new ContentValues();
        cv.put(column, newScore);
        database.update(MySQLiteHelper.TABLE_HIGHSCORES, cv, MySQLiteHelper.COLUMN_ID + "=1", null);
        result=true;
    }
    cursor.close();
    return result;
}

如何解决此问题?因为当我运行我的应用程序时会显示上述错误。

0 个答案:

没有答案