Sign in Go Pro

Android Model-View-ViewModel Pattern

Binding the View - Binding View Inputs with Two Way Binding

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
Autoplay

Up next

Previous

About

Two way binding is a powerful feature of Android Data Binding that allows you to bind inputs, like an EditText, to data in a ViewModel while also updating that data back on the ViewModel as the user interacts with it. This means that any changes the user makes to your two way bound inputs, will be reflected in the ViewModel right away and any changes that the ViewModel makes, will be reflected in the View. This lesson will teach you how to do this.

Key concepts in this lesson that you will learn:
* How to two way bind an Edit text to a ViewModel backed variable.
* Two approaches to keeping your View in sync with updates to those variables.
* Approach 1: Using an ObservableField.
* Approach 2: Extending BaseObservable and notifying the view of a change.
* The benefits and downsides to each approach.

Instructor

Links

Comments

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

>
You need to go PRO to post comments.

Lessons in Android Model-View-ViewModel Pattern