0

我尝试使用活动的 android,我对如何在表中实现自动增量字段有疑问?

在他们的文档中,他们提供了这样的代码

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

我们可以让 remoteId 字段自动递增吗?

4

1 回答 1

1

在 sqlite 中,您应该在创建表中使用 Autoincrement 标记:http ://www.sqlite.org/autoinc.html

在其他情况下,使用 getPrev()、getNext() 等方法。

于 2014-09-29T14:10:08.350 回答