Trevor, I don`t know if I got it right but.... Wha...
# android
j
Trevor, I don`t know if I got it right but.... What I meant was something like ...
Copy code
@Module(subcomponents = ComponentA.class)
public class ActivityAModule
@Inject
ActivityA activity;

@Provides
@ActivityScope
public providePresenter()
{
return new PresenterA( (View) activity);
}

 @Binds
    @IntoMap
    @ActivityKey(ActivityA.class)
    abstract AndroidInjector.Factory<? extends Activity> bindActivityInjectorFactory(MainComponent.Builder builder);
The modules that don`t need the Activity.. would not need to have the instance..
t
what does the dagger processor do when you run it like this? my understanding was that the activity is not on the object graph at which point the processor would fail. Although this is all just based on my understanding and resulting assumptions.
I would think you would need either a
@BindsInstance
method on your component builder or a
@Provides
from a module. But because the creation of the component is abstracted away out of your control you can’t actually provide the instance of the activity in order to perform the binding via either the component builder binds instance method or via module constructor injection.
j
Ohh, just now I saw the thread..
Well, that does not work.. it was more a suggestion of how it could work
I am trying to archive it with
@BindInstance
, but I am failing
I tried to create an issue in the dagger github, but the developer did not understand what I meant… or I did not understand what he meant
If you could help me to hightlight the problem there… it would be of great help.
t
looks like your SO question got a good answer a little while ago
j
Thank you! 😄