Can you please let me know how to use Dagger when instantiating Presenter with injected parameters…
Prabin Timsina
1

(I’m away from a keyboard right now, so expect typos and syntax errors)

In my `Activity`, I declare a way to instantiate the `Presenter` lazily.

To do this, you’ll decare the `Presenter` in a dagger module normally, but in your Activity, you’ll add something like this:

`@Inject Lazy<YourPresenter> presenterProvider;`

So you’ll still have your check for if the retained `Presenter` is null, but instead of using `new` directly, you’d use the `presenterProvider.get()` method of your lazy presenter.

Show your support

Clapping shows how much you appreciated Craig Russell’s story.