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.
Create databound activity - Android Tutorial
From the course: Android Development: Data Binding
Create databound activity
- [Instructor] So in a previous video, I demonstrated how to modify the layout for our sample data activity to incorporate data binding code and expressions. So now we're going to see how to connect the logic for the activity to the layout. So let's go to the simple example activity file. And what we're going to do is make sure we're scrolled up. So there's two steps we need to complete here. First, we need to inflate the activity using the data binding utility class. And this is what gives us access to all the fields that are contained within the layout that have IDs. And this is what lets us get rid of all those fine view by ID calls. So what I'm going to do is create a variable called binding. Okay, and that's going to be of type activity simple example binding. Now, you might be wondering, like, well, wait a minute, where did that type come from? We didn't create it or define it…
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.