Realm and auto increment Behavior (Android)

后端 未结 8 2112
野的像风
野的像风 2020-12-14 16:22

I\'m trying to get data from Realm using an ID as a reference. However, when querying for an ID, I\'ve found that Realm is giving me the same ID for all elements (ID of 0).

8条回答
  •  眼角桃花
    2020-12-14 16:45

    if your Id is Long then:

    val nextId = bgRealm.where(Branch::class.java).max("localId") as Long + 1
    

提交回复
热议问题