Sign in Go Pro

Realm & Android Architecture Components

How to Abstract Realm Completely from Activities and Fragments


This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



### Description The combination of LiveData, LiveData Transformations, and Interfaces, allows you to abstract your Realm domain model and database in a way that was not previously possible. This lesson will teach you how to use LiveData with Transformations and Realm effectively, so that you can abstract your Realm data models entirely from your Activities and Fragments. ### Summary of Content (what you will learn): * How to expose `LiveData<List<? extends Model>>` from your DAOs, where `Model` is * A Read Only view of your data. * Database Agnostic - No ties to Realm or your underlying data model entities. * An interface that can easily be mocked for testing. ### Additional Materials * [How to use LiveData w/ Realm]( * [Using LiveData Transformations w/ Realm]( * [Abstracting RealmResults from your Application to Reduce Coupling and Improve Testability](abstracting-realmresults-from-your-application-to-reduce-coupling-and-improve-testability)

Lessons in Realm & Android Architecture Components