Sign in Go Pro

Android Architecture Components - A Deep Dive

Transformations with LiveData

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
Autoplay

Up next

Previous

About

Transformations class is provided if you want to make changes to the value stored in a LiveData object before dispatching it to the observers, or if you want to return a different LiveData instance based on the value of another one.
It is useful when you want to create chain reaction between LiveData or react to changes in another LiveData.

Transformations class provides 2 transformations out-of-box:

  1. map is useful when you want to make changes to the value before dispatching it to the UI.
  2. switchMap is useful when you want to return different LiveData based upon the value of the first one.

In this lesson, we will build a Pokemon app and use transformations to show the selected Pokemon in the PokemonDetailActivity

Comments

There are no comments on this lesson, start the conversation below ...

>
You need to go PRO to post comments.

Lessons in Android Architecture Components - A Deep Dive