Hilt question
I have an app module and a feature-module.
In the feature module I have a class that requires applicationContext. I add it to the constructor with the @ApplicationContext annotation. Everything works fine. In the same class, I now require activityContext... so I do
@ActivityContext private val activityContext: Context
but I get a compile time error about Context not being provided. Is this use case of using two qualified contexts, not supported for some reason? or is Hilt bugging out on me
n
Nicholas Doglio
05/16/2024, 2:07 PM
What's the scope of the class you're trying to inject an Activity Context in? I imagine it would need to be
@ActivityScoped
c
Colton Idle
05/16/2024, 2:18 PM
ah. i guess thats the issue. it eventually makes its way into a AAC ViewModel. so since VMs outlive activity, i can't inject an activity./ i think