1

我正在尝试检索表中行的行 ID,但所有行都为零。这基本上就是我正在做的事情:

long getIdForPosition(int position) {
    Cursor cursor = getContentResolver().query(uri, null, null, null, sortOrder);
    cursor.moveToPosition(position);
    long _id = cursor.getLong(cursor.getColumnIndex(MyTable.COLUMN_ID)); // The value for COLUMN_ID is "_id"
    cursor.close();
    return _id
}

这将为所有行返回零。光标有效且移动到有效位置

4

0 回答 0