Android data binding — 4
Sample form data binding
In this section, we gather all things in previous sections into one demo.
Demo includes:
- User compose message included: receiver email & message content
- User has to fulfill the form
- Receiver email have to be in right format. UI shows that email is correct or not
- UI form also counts number of message characters
Check out source code at: https://github.com/rickyngk/android-data-binding-example/tree/master/sample4
Some highlight points in this demo
1. Pass view-model into child layout (when using <include>)

2. Get element via ID using binding object

3. Hide/show element using binding expression

See Binding Expression document for more detail