Archie
09/14/2020, 10:11 AM@ActivityRetainedScoped but have a value injected to it from the Activity. I need the depedency to survive device rotation but the problem is it also needs a value taken from the `Activity`'s bundle. Any advise on how to work around this?allan.conda
09/14/2020, 10:25 AMArchie
09/14/2020, 10:26 AM@Inject
lateinit var myObject: MyObject
...
myObject.setValue(someValueFromBundle)
??allan.conda
09/14/2020, 10:27 AMallan.conda
09/14/2020, 10:28 AMallan.conda
09/14/2020, 10:29 AMclass MyViewModel @ViewModelInject constructor(
@Assisted savedStateHandle: SavedStateHandle // your bundle args is here
): {
private val myArg = savedStateHandle.get("arg_key")
}Archie
09/14/2020, 10:36 AMallan.conda
09/14/2020, 10:38 AMsavedInstanceState == nullArchie
09/14/2020, 10:40 AMViewModel to hold the states instead of just a scoped object. making ViewModel hold states is probably the correct way anyway.allan.conda
09/14/2020, 10:43 AMArchie
09/14/2020, 10:43 AMallan.conda
09/14/2020, 10:43 AM