Sign in Go Pro

Realm & Android Architecture Components

Abstracting RealmResults from your Application to Reduce Coupling and Improve Testability

11/30/2017

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next

Previous

About

Traditionally, in a Realm Application, it's been necessary to directly expose RealmResults to the various layers of your app because there was no standard way to deliver the live -- auto updating, reactive -- data that RealmResults provided. This has all changed with the advent of LiveData. LiveData as it's name implies is a container for live, reactive data, that is also Android Lifecycle aware. This lesson will teach you how use Realm with/ LiveData to remove the dependency on RealmResults from outside of your DAO layer. ### Summary of Content (what you will learn): * How to expose `LiveData<List<? extends RealmModel>>` from your DAOs. * Why you no longer need RealmResults when exposing LiveData. * The benefits that LiveData provides. ### Additional Materials * [How to use LiveData w/ Realm](http://watch.caster.io/lessons/realm-android-architecture-components-live-data) * [Using LiveData Transformations w/ Realm](http://caster.io/lessons/using-livedata-transformations-with-realm)

Lessons in Realm & Android Architecture Components