I have around 20 rows in RealmResults and need to sort the list with recent dates
RealmConfiguration realmConfig = new RealmConfiguration.Builder(getActivity()).build();
Realm realm = Realm.getInstance(realmConfig);
Like below
RealmResults<MyTable> List = realm.where(MyTable.class).findAll().sort("date",SORT.DESCENDING);
It's really just the following.
RealmResults<MyTable> list = realm.where(MyTable.class)
.findAllSorted("date",Sort.DESCENDING);
And since 4.3.x:
RealmResults<MyTable> list = realm.where(MyTable.class)
.sort("date",Sort.DESCENDING)
.findAll();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With