Created
December 7, 2019 14:10
-
-
Save user-mw/eb98c17f7819876121c6c6da3a017ec9 to your computer and use it in GitHub Desktop.
FragmentActivity getViewModelStore()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ViewModelStore getViewModelStore() { | |
// Code | |
if (mViewModelStore == null) { | |
NonConfigurationInstances nc = | |
(NonConfigurationInstances) getLastNonConfigurationInstance(); | |
if (nc != null) { | |
mViewModelStore = nc.viewModelStore; | |
} | |
if (mViewModelStore == null) { | |
mViewModelStore = new ViewModelStore(); | |
} | |
} | |
return mViewModelStore; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment