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;
}
如何解决此问题?因为当我运行我的应用程序时会显示上述错误。