https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
b

Brian Donovan

09/18/2021, 3:51 PM
can I get some better understanding on what viewModelFactory does please. ty
👍 1
😶 1
v

Viktor Petrovski

09/19/2021, 8:13 PM
ViewModelFactory it is a factory class that creates ViewModel objects and configure them so they can survive configuration changes. If you create your object like any other regular the ViewModel won’t be aware of the activity lifecycle, does that makes things a bit more clear?
https://developer.android.com/codelabs/kotlin-android-training-view-model#0 This might be a good exercise to dive deeper into ViewModel
m

marlonlom

09/24/2021, 2:16 AM
Vmfactory males More isolated the instantiation of viewmodels, with things such as passing parameters and enhancing the Ui testing of the viewmodels 👍
4 Views