https://kotlinlang.org logo
#android
Title
# android
j

Jast Lai

07/13/2022, 4:19 AM
Hi, I have an question about Activity and ViewModel。 I used
Copy code
ViewModelProviders.of(MyActivity::this).get(ViewModel::class.java)
to create a view model by activity. And view model has same instance after a configuration changed (e.g. rotation screen). It's all right and work fine. But I wonder how does view model keep it self's instance even activity has new instance after a configuration changed ?
😶 1
4 Views