How can I set LIMIT in query in Realm?

后端 未结 4 2105
走了就别回头了
走了就别回头了 2020-12-06 14:53

I have done R&D for limit in query with no success. There is one way with which to paginate data in Realm with sub list but no success with that. It shows d

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-06 15:40

    You can use limit from Realm 5.6.0+. It looks like this.

    val myDataList = Realm.getDefaultInstance()
        .where(MyData::class.java)
        .limit(10)
        .findAll()
    

    Look this document

提交回复
热议问题