Sign in Go Pro

Realm & Android Architecture Components

How to use LiveData w/ Realm


Up next



LiveData is similar to RealmResults except that LiveData respects the Lifecycle of the owners subscribed to it. LiveData will automatically stop emitting values when there are no active listeners, and start again when it’s listeners become active.

This lesson will teach you how to return RealmResults as LiveData.

Summary of Content (what you will learn):

  • How Realm's objects, relate to LiveData
  • The benefits of using the LiveData with Realm
  • How to expose RealmResults as LiveData
  • A deeper understanding of how LiveData updates and how to use for any type of live auto updating data.
  • The difference between LiveData's setValue and postValue methods and their intended usage.

Additional Materials



Lessons in Realm & Android Architecture Components