Created
May 25, 2018 18:01
-
-
Save joseprl89/cd98f9a9e7e96c2f10bc73a9c80d273b to your computer and use it in GitHub Desktop.
How FragmentActivity.onDestroy avoids clearing the store for https://medium.com/@josep.rodriguez/internals-of-android-architecture-components-part-i-the-viewmodel-d893e362a0d9
This file contains hidden or 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 void onDestroy() { | |
mCalled = true; | |
// Use mStateSaved instead of isStateSaved() since we're past onStop() | |
if (mViewModelStore != null && !mHost.mFragmentManager.mStateSaved) { | |
mViewModelStore.clear(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment