So, if I use
homeViewModel = ViewModelProviders.of(this).get(HomeViewModel::class.java)
it should return me an existing instance of ViewModel
, instead of creating new one, right? Well, in the case below it doesn’t work like that, and if you straggling the same problem and don’t want to waste much time to read the whole article, just give a try this code val homeViewModel: HomeViewModel by navGraphViewModels(R.id.mobile_navigation)