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.
Using binding adapters - Android Tutorial
From the course: Android Development: Data Binding
Using binding adapters
- [Instructor] In this example, we're going to learn about binding adapters. Binding adapters are responsible for making the right framework calls to set values based on the binding expression that's being used. So let's take a look at the code for the view model layout. All right. And so let's scroll down to the text view here for the current temperature. So when you attach a binding expression to an attribute, the data binding engine will try to find a method on that object, which in this case is a text view named set along with whatever the attribute name is. So in this case, set text to set that value on that attribute. So for this binding expression on the text attribute, data binding's going to try to find a method named set text, which if we look over in the framework docs. All right, so here in the documentation for the text view, if we look for these text function, okay. It looks like there's a couple down here.…
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)
-