I have made my component Lifecycle-aware. I want to use activityContext in that component.
My question is: is there any way to use activityContext from the Lifecycle object?
I have made my component Lifecycle-aware. I want to use activityContext in that component.
My question is: is there any way to use activityContext from the Lifecycle object?
Copyright © 2021 Jogjafile Inc.
There is not a way to do this - among other reasons, the
LifeCycleobject might not be backed by anActivity, or even anything attached to anActivity(for example,ProcessLifecycleOwner, and components depending onLifecycles should be agnostic of what that lifecycle is.Instead, you should have the code creating your component pass it an
Activitycontext.