I'm wondering how to dependency inject into a feat...
# android
I'm wondering how to dependency inject into a feature module. All of the examples I see uses an activity. Is it not possible to use a feature module without a separate activity? From what I've seen you can just navigate by single-activity navigation and specify which module a certain navigation action goes to. I can't figure out how to get dagger working though. This is in one of my modules.
Copy code
    dependencies = [AppComponent::class],
    modules = [
interface StartupComponent : AndroidInjector<BaseApplication> {
    fun inject(activity: MainActivity)
But I have nowhere to initialize this component from. This is the error that I get:
No injector factory bound for Class<ferm.jonny.startup.presentation.fragments.ExtendedSplashScreenFragment>
Hi, I am currently using
but here is my approach for that hope it can help you. In this approach my activities and fragments extends from DaggerFragment and DaggerAppCompactActivity. But it's basically adding the AndroidInjectors.inject(this) automatically.
Thanks I'll have a look. However it looks like you use module activities in that example. Is that considered good practice in a single-activity pattern? I've found a guide here: https://medium.com/@ffvanderlaan/dynamic-feature-and-regular-modules-using-dagger2-12a7edcec1ff He seems to be doing what I want, and I'll try to follow that example when I've finished clearing all the other errors that I have from moving a lot of stuff around.
Yes, in one of Ian Lake talks he said is not mandatory to have only 1 activity for your project, but rather prefer to go for fragments instead. Activities should be need only when they are really necesarry, if they dont then you can go one activity and full fragments.