i have a model that contains a RealmList of another realm objects and i want to use these objects to be used by my adapter which extends RealmBasedRecyclerViewAdapter which i used in conjunction with RealmRecyclerView. How do I convert RealmList to RealmResults since constructor of RealmBasedRecyclerViewAdapter only accepts RealmResults?
You can do list.where().findAll()
. There is a open issue for letting both both RealmList
and RealmResults
implement a shared interface to avoid these kind of problems in the future: https://github.com/realm/realm-java/issues/1363
Edit: From Realm 3.0.0, both RealmResults
and RealmList
implement the OrderedRealmCollection
interface, and both support change listeners. So with Realm Android Adapters 2.0.0 or above, there is no need for the above workaround.