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

Using binding adapters - Android Tutorial

From the course: Android Development: Data Binding

Start my 1-month free trial

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.…

Contents