Auto increment in active android

2020-05-06 19:57发布

I tried to use active android, i have a doubt about how could i achieve a auto-increment field in a table?

In their documentation they have provided a code like this

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

Can we make the remoteId field auto-increment?

1条回答
Deceive 欺骗
2楼-- · 2020-05-06 20:48

In sqlite you should use Autoincrement tag in create table: http://www.sqlite.org/autoinc.html

In other cases use methods like getPrev(), getNext(), etc.

查看更多
登录 后发表回答