2014-09-29 57 views
0

我試圖使用活動的android,我有一個疑問,我怎麼能實現表中的自動增量字段?自動增量在活動的android

在他們的文件他們提供這樣的

Item item = new Item(); 
item.remoteId = 1; 
item.category = restaurants; 
item.name = "Outback Steakhouse"; 
item.save(); 

,我們可以使remoteId場自動增加一個代碼?

回答

1

SQLite中,你應該使用自動增量的標籤在創建表:http://www.sqlite.org/autoinc.html

在其他情況下,使用方法,如getPrev(),GETNEXT()等

+0

https://github.com/thecodepath/android_guides/wiki/ActiveAndroid-Guide 這是庫,但這裏沒有提到如何自動增量。 – 2014-09-29 17:15:44

+0

@luttuandroid請提供您想要使用此庫的項目的代碼 – QArea 2014-10-02 12:37:00