Reputation: 1815
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?
Upvotes: 1
Views: 795
Reputation: 20157
There is not a way to do this - among other reasons, the LifeCycle
object might not be backed by an Activity
, or even anything attached to an Activity
(for example, ProcessLifecycleOwner
, and components depending on Lifecycle
s should be agnostic of what that lifecycle is.
Instead, you should have the code creating your component pass it an Activity
context.
Upvotes: 3