I’m using here Dagger Providers to avoid creating new instances of dependencies after every configuration change.

I wonder how using Provider<T> affects scoping of T . In other words, provider.get() would return a new instance each time if classT does not have appropriate scoping (i.e. annotated with a dagger scope). This means, it doesn’t matter you inject Provider<T> or T in constructor of Factory , because semantically these two things would result in same output: either you will receive the same “activity-wide” T (if T has scoping) or you will receive a new T (if T has no scoping).

Particularly in your case you should see no difference, because MoviesPresenterFactory should be singleton, thus not being created for each new instance of MoviesActivity .

Let me know if you agree on these thoughts, or otherwise if I’m missing something please point that out.

Thanks for the post!

Android enthusiast, Google Certified Android developer, Stackoverflower

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store