Aiden
11/15/2019, 6:58 AMpawegio
11/15/2019, 8:39 AMMainActivity using e.g. ViewModelProviders factory?Lebohang
11/25/2019, 1:58 PMprivate lateinit var viewmodel within the onCreate() method you will instantiate the viewmodel in the following format viewmodel = ViewModelProviders.of(this, factory).get(MainViewModel::class.java) , factory represent the factory for you view model. But you can also do it the following way if you are using new android version: private val viewModel by viewModels<MainViewModel> { factory }