Sign in Go Pro

Android Model-View-ViewModel Pattern

Binding the View - Binding Formatted Strings

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



In this lesson you'll learn how to expose, localized formatted strings from your ViewModel and bind to the values using DataBinding.

Key concepts in this lesson that you will learn:
* How to expose data to your View without exposing your Model.
* TDD approach to testing your ViewModel to ensure the expected variables exposed to your View are formatted correctly.
* How to use Android Formatting Strings from your ViewModel, while still testing inside a Unit test.
* How to use a binding expression to bind to variables exposed by the ViewModel.


Hey Eric, great course, thank you!

Just wondering, do you know any approach to test if the notifyChange was been called?

Thanks Bruna! :-) . I would typically cover this implicitly as part of an Espresso test, after I've JUnit tested the core business and presentation logic.

You didn't mention how to mock logs ?


Lessons in Android Model-View-ViewModel Pattern