Created
December 7, 2019 10:11
-
-
Save user-mw/ad89330eb27979c51da53736ba200b48 to your computer and use it in GitHub Desktop.
ViewModelStores 2017
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 сlass ViewModelStores { | |
public static ViewModelStore of(FragmentActivity activity) { | |
if (activity instanceof ViewModelStoreOwner) { | |
return ((ViewModelStoreOwner) activity).getViewModelStore(); | |
} | |
return holderFragmentFor(activity).getViewModelStore(); | |
} | |
// Code | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment