Mladen Rakonjac
Aug 22, 2017 · 1 min read

Accent was on Dagger 2.11 . With this setup it will not work. As I said, it is the simplest MVP.

To preserve Presenter I would apply some changes:

  1. There is no need to bind and inject view instance
  2. I would make two new methods in presenter: connectView(View view) and disconnectView(View view) that would be called in onResume and onDestroy methods.
  3. disconnectView(View view) should set view to be null
  4. In Presenter, we should always check if view instance is null before calling any method on it. For example we should do:
if(view != null){
view.showNewText("Presenter is injected and subscribed");
}

I hope that is the answer on your question. If you have more questions, please don’t hesitate to write :)

)

    Mladen Rakonjac

    Written by

    Android Engineer at www.infinum.com

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade