Sign in Go Pro

Android Model-View-ViewModel Pattern

Binding the View - Passing Variables to Children Layouts

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



Android Views are composed as a hierarchy with a single root View which usually has many children Views inside of it. These Views are declared inside of an XML file, called a layout file or layout. Often, to support modularity and code reuse, you'll end up breaking parts of the layout into children layouts. In the case of Data Binding, this means you'll need a way to pass variables that you define in the parent layout, down to it's children. This lesson will teach you how to do that.

Key concepts in this lesson that you will learn:
* How to pass a Data Binding View Variable from a parent layout down, to a child layout.
* How to make use of Android Studio's quick assist features to convert existing layouts to use Data Binding.
* Best practice for naming consistency of variables across the parent and child layout.


There are no comments on this lesson, start the conversation below ...


Lessons in Android Model-View-ViewModel Pattern