I am pulling all my data from realm and displaying initially in a sorted list.Whenever items are added or removed or modified to this list i would like it to still be sorted.Is there a way realm can manage this sorted list internally and update the adapter or do i need a change listener and then manually sort it?
Asked
Active
Viewed 388 times
0
-
use `findAllSorted()` or `findAllSortedAsync()` – EpicPandaForce Apr 23 '17 at 11:35
-
I have done that ,it would give me an initial sorted list, when i add a new item or delete or update an item i would like the list to be up to date without fetching the entire list all over again from realm and applying it. – Jude Fernandes Apr 23 '17 at 11:43
-
well yes, that is why you use `findAllSorted()`/`findAllSortedAsync()`, because it does exactly that – EpicPandaForce Apr 23 '17 at 12:15
-
@EpicPandaForce so whenever a CRUD operation occurs how would i reflect that change to the recycler view? – Jude Fernandes Apr 23 '17 at 19:47
-
1if you are using a `RealmRecyclerViewAdapter` from `realm-android-adapters` then if you provide the `RealmResults` to the adapter directly, then this is entirely automatic and you don't need to do anything beyond using `RealmRecyclerViewAdapter` with `true` for auto-updates – EpicPandaForce Apr 23 '17 at 20:51