From the course: Android Development: Data Binding

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Overview of observables

Overview of observables - Android Tutorial

From the course: Android Development: Data Binding

Start my 1-month free trial

Overview of observables

- [Instructor] Up until now, we've been using a regular class to hold the data that we've been binding to in our layouts. Now, the downside of using regular data classes is that when data in the class changes, the layout doesn't automatically get notified of the change so it can update its fields. If you want the data in the layout to update in response to changes within the model, then you have to have some type of observable data model. In this chapter, we're going to look at two different ways of creating observable data models. So the first uses the framework-provided observable classes, such as ObservableField, ObservableInt and some others. The second method involves binding data directly to the ViewModel architecture components using LiveData, which are an improvement over observables since they are lifecycle-aware components. We're also going to see how to create BindingAdapters which can be used to adapt data within the…

Contents