Hi guys!
Using the following module declaration
val module = module{
viewModel { MyModule(get()) } // MyModule extends ViewModule
}
The MyModule object gets created every time it is injected even when I rotate the device. It also doesn’t follow the activity lifecycle, did I do any mistake during the configuration?
n
nwh
01/08/2019, 1:16 AM
Hey, I'm no expert, but maybe try the
getSharedViewModel
methods or similar. I think that makes them persist longer. According to the documentation it says it reuses the same model across multiple fragments of a single Activity.