From the course: Android Development: Data Binding
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Binding to observables - Android Tutorial
From the course: Android Development: Data Binding
Binding to observables
- [Instructor] In this example, we're going to take our existing, simple data model and make it observable. So that changes to the data are reflected in the layout. So let's open the observable weather data class here in our editor. And we can see that this is a data class, just like our simple example, but in this case, the fields are observable data types. So we have observableInt for the temperature and the windchill and observable field of type string for the conditions. Let's also open up the observable fields activity, and we have some code that's similar to these simple example, but we just need to add our modifications. So first I'm going to instantiate an object of the observable weather data class. So I'm going to make a private value called obs_weather. And that going to be equal to a new observable weather data object. And then I'll pass in some values for the fields, so I'll pass an observableInt, and we'll…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Overview of observables1m 51s
-
(Locked)
Binding to observables4m 49s
-
(Locked)
Binding to ViewModels6m 25s
-
(Locked)
Using binding adapters7m 19s
-
(Locked)
Two-way binding syntax4m 45s
-
(Locked)
Using converters4m 2s
-
(Locked)
Challenge: Color binding adapter1m 18s
-
(Locked)
Solution: Color binding adapter2m 26s
-
(Locked)
-