Home ยป Android ยป kotlin – Android: Add a ViewmodelFactory to a viewModel by NavGaphViewmodels-Exceptionshub

kotlin – Android: Add a ViewmodelFactory to a viewModel by NavGaphViewmodels-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

I’m learning Kotlin and I have a viewModel which is created as navGraphViewModels().

private val viewModel: CreationSignalementViewModel by navGraphViewModels(R.id.creation_signalement_nav_graph)

I would like to know if it’s possible to add a ViewModelFactory to this viewModel declaration ?

thank you ๐Ÿ™‚

How to&Answers: