Sign in Go Pro

Android Model-View-ViewModel Pattern

Building the ViewModel

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
Autoplay

Up next

Previous

About

The ViewModel connects the View and the Model, providing the necessary inputs and actions for the View to bind to. It also performs any presentation logic necessary.

In this lesson you will learn how to:
* Create a ViewModel
* Add View variables and actions to the ViewModel
* Add presentation logic to translate inputs from the View into data with which the Model can work.

Comments

Looks like Eric renamed the model being used from RestaurantCalculator, to Calculator.

Hi Steve,

You are correct. In lesson 3, "Building the ViewModel, the Origin of the Data", I used the name RestaurantCalculator and RestaurantCalculatorTest. Starting at this lesson and for the rest of the course, I renamed that model to Calculator and CalculatorTest.

I thought this would be easier to say and read in code once we introduce ViewModels and other concepts based off of that model. However, I didn't talk about the fact that I renamed it in the lesson. I could see how that might be confusing. My apologies, but thanks for pointing it out!! I hope it saves others' confusion!! :-)

That is the only change I made in this course. Everything else should be consistent.

It saved my time too.

>
You need to go PRO to post comments.

Lessons in Android Model-View-ViewModel Pattern