Skip to content

MultipleParametrizedFactory

Shanti Ranjan Das edited this page Jan 30, 2020 · 1 revision

This class is responsible for generating ViewModel object with constructor.

Usage

val viewModel = ViewModelProvider(context,ViewModelProviders.of(this,MultipleParametrizedFactory(arrayOfObjects)).get(YourViewModel::class.java))

This will provide you the object of ViewModel. There is a shorter approach for doing it. initViewModel, Which is defined in ViewModelUtils. You can see the calling and other stuff here).

Clone this wiki locally