We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support lib v7:26.1.0 Architecture components beta2
VM created in Activity using stockcheckViewModel = ViewModelProviders.of(this).get(StockcheckViewModel.class);
And in fragment (from onCreateView) stockcheckViewModel = ViewModelProviders.of(getActivity()).get(StockcheckViewModel.class);
Fragment created in activity using getSupportFragmentManager()
Stepping through the code it seems that the ViewModelProvider creates a different stores instance for the Activity and Fragment
https://stackoverflow.com/questions/46574672/lifecycle-viewmodel-not-shared-between-activity-and-fragments
The text was updated successfully, but these errors were encountered:
in your samples, i don't see where initViewModel is called. If you are calling it before onCreate, you might end up in this situation.
initViewModel
onCreate
Sorry, something went wrong.
Please file issues with ViewModel on the issue tracker with a sample project that reproduces your issue.
No branches or pull requests
Support lib v7:26.1.0
Architecture components beta2
VM created in Activity using
stockcheckViewModel = ViewModelProviders.of(this).get(StockcheckViewModel.class);
And in fragment (from onCreateView)
stockcheckViewModel = ViewModelProviders.of(getActivity()).get(StockcheckViewModel.class);
Fragment created in activity using getSupportFragmentManager()
Stepping through the code it seems that the ViewModelProvider creates a different stores instance for the Activity and Fragment
https://stackoverflow.com/questions/46574672/lifecycle-viewmodel-not-shared-between-activity-and-fragments
The text was updated successfully, but these errors were encountered: