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




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



Lessons in Realm & Android Architecture Components