1

I am facing an issue, when I do inject a nested view into my base view's constructor using @inject. I am not able to handle the nested view's events in it own presenter. Because of which I need to handle them in the Base View's presenter. I have 2 view and their respective presenter's : AppBaseView - AppBasePresenter; LoginView - LoginPresenter. I @inject LoginView into the AppBaseView. Now that I have to handle the Login Button event, I am not able to do so in the LoginPresenter, but need to handle it in the AppBasePresenter. No idea why does that happen. Am I missing anything? Any light on this issue would be higly appreciated.

Thanks.

Nitish Borade
  • 367
  • 3
  • 18

1 Answers1

1

If you are trying to inject the same view into multiple classes, remember that you have to mark it as @Singleton, or otherwise ensure that both classes receive the same instance. By default Guice and Gin create a brand new instance every time you inject a class. It's hard to tell from your description, but you might be adding an event listener to an instance that the presenter owns and then displaying a different instance in your application.

Jeff Bowman
  • 90,959
  • 16
  • 217
  • 251