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. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have some google sign in stuff that requires access to an Activity, but I want to abstract it away as
SaveEmailAuthCredentialsand 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
androidContextshould 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?All reactions