State inside FeatureModule of Hilt simple example is not persisted across process death
See original GitHub issueNot persisting such state can cause unexpected behaviors and bugs, especially if this is used to share state between screens.
This raises following questions:
1.) if ViewModel is used under the hood for ActivityRetainedComponent, then how do I intercept onCleared()
in my custom classes?
2.) if ViewModel is used under the hood for ActivityRetainedComponent, then how do I get a SavedStateHandle into my custom classes?
3.) if ViewModel is not used for ActivityRetainedComponent, how do I get a reference to the SavedStateRegistry into my custom classes?
Overall, the question boils down to:
- how to save state inside an ActivityRetainedComponent across process death?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Hilt (Android): cannot find symbol return ... - Stack Overflow
I got the same error message. My problem was that I had an old/deprecated gradle dependency. Make sure to remove following dpenedency from ......
Read more >All about Hilt. Get deeper understanding about Hilt.
Hilt is a dependency injection framework for Android that is built on top ... for example, the time/duration between birth and death is...
Read more >Lucas on Twitter: "@Zhuinden That ActivityRetainedComponent for ...
State inside FeatureModule of Hilt simple example is not persisted across process death · Issue... dagger/java/dagger/hilt/android/example/gradle/simple/feature ...
Read more >Migrating to Hilt - Dagger
Any method defined directly on the component interface can be moved to either the aggregator interface or one the aggregator extends. Example: Java....
Read more >Navigation | Android Developers
Navigation Safe Args will no longer cause deprecation warnings in ... and its destination's state after process death and recreation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes,
@ViewModelInject
classes inject themselves from theActivityRetainedComponent
. This is true regardless of what ViewModelOwner is used.That would solve it!
BTW, is ActivityRetainedComponent deps inherited into
@ViewModelInject
annotated ViewModels?