I have a class A that takes AppCompatActivity as a parameter. I want to be able to inject A using dagger. Is there a way to do that? (I'm also wondering if this is an anti-pattern)
d
Daniel Perez
01/19/2023, 5:33 PM
It sounds like something you probably should not do for lifecycle/memory leak reasons.
Does A take AppCompatActivity as a constructor parameter? The AppCompatActivity is probably going to be a parameter you won't have until runtime. AssistedInjection might be a good fit here.
s
Susheel
01/19/2023, 5:39 PM
Yeah I figured that it was potentially a bad practice. Basically class
A
handles navigation logic and needs the activity instance to perform operations like