How can I set LIMIT in query in Realm?

后端 未结 4 2083
走了就别回头了
走了就别回头了 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

    Now limit is supporting

    I did that using limit method, You should use latest version classpath "io.realm:realm-gradle-plugin:5.8.0"

    RealmResults realmResults = mRealm.where(YourPOJOClass.class).sort("createdTime").limit(10).findAll();
    //here this record will be sorted by ascending order using schema name "createdTime" 
    //this will return the 10 rows only.
    

    `

提交回复
热议问题