我想從我創建的Android表格中的自動增量獲取行ID(_id) 我可以看到表中的所有其他字段主鍵字段除外。 此標識的表的代碼:如何在Android中的sqllite中查看主鍵ID字段
public static final String ID = "_id";
public static final String JOKE = "Joke";
public static final String AUTHOR = "Author";
public static final String DATE = "Date";
public static final String STATUS = "Status";
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + TABLE_NAME + " ("
+ ID + " INTEGER PRIMARY KEY AUTOINCREMENT , "
+ JOKE + " TEXT, "
+ AUTHOR + " TEXT, "
+ DATE + " DATE, "
+ STATUS + " TEXT "
+ ")");
}
當我試圖接受我收到領域的指數-1領域ID
Cursor cur = context.getContentResolver().query(MyContentProvider.CONTENT_URI, null, null, null, null);
if (cur.moveToFirst()) {
int idColumn = cur.getColumnIndex("_id");
int authorColumn = cur.getColumnIndex("Author");
int statusColumn = cur.getColumnIndex("Status");
int dateColumn = cur.getColumnIndex("Date");
,我可以看到所有的索引其他領域,但關鍵字段(_id) 任何人都可以幫助我?