I figured out a solution to achieve this after so many days using the โbetweenโ requests, as shown in the official docs https://realm.io/docs/java/latest
If you want to get the first N elements, just pass the score with and with the field name below
realm.where(clazz).between("count",0,1000).findAll();
Where
"count" = Field name (for example, the variable name in your pojo)
"0" = Range from
"1000" = Range to
For example: the above query will retrieve the first 0 to 1000 as RealmResults.
Note. The above solution only works if you have a unique identifier with the number of rows. In my case, I manually inserted the row counter value before pasting the values โโinto Realm.
Chandru
source share