Auto increment in active android

大憨熊 提交于 2019-12-02 14:54:51

问题


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.



来源:https://stackoverflow.com/questions/26096525/auto-increment-in-active-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!