Sign in Go Pro

Android MvRx Fundamentals

Initialize Your State Properties

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
Autoplay

Up next

Previous

About

Although you can usually model your state such that it can be initialized with all default values, this isn't always practical. This lesson will introduce the concept of a MvRxViewModelFactory which enables you to hook into the MvRx lifecycle and assist MvRx in creating your initial state. MvRxViewModelFactory.initialState provides a ViewModelContext. A ViewModelContext provides access to the Fragment, Activity, and Application that is creating the ViewModel. You can use any of these to grab dependencies or arguments that are helpful in creating your initial state.

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 MvRx Fundamentals