Resolve Fragment's activity in fragment scope? #1666
Unanswered
carterhudson
asked this question in
Q&A
Replies: 1 comment
-
I have the same issue, I need to isolate the activity from the of the code, but i need th activity for the CredentialsManager, so I need it in the activity scope only. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have some google sign in stuff that requires access to an Activity, but I want to abstract it away as
SaveEmailAuthCredentials
and hand it to myViewModel
. To avoid memory leaks, I'd like to use scopes. As such, my module looks like this:My understanding is that
androidContext
should resolve the closest context to the scope, which would be theEmailAuthFragment
's Activity. However, when I useandroidContext()
here, it's retrieving the Application Context. Do I need to somehow nest my Fragment scope within an Activity scope in order to have access to the Activity?Beta Was this translation helpful? Give feedback.
All reactions