Auto increment in active android

2020-05-06 20:16发布

问题:

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:

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.