I have a class A that takes AppCompatActivity as a...
# dagger
s
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
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
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
startActivityForResult
etc.