Giannis Tsironis, injecting DialogFragments
are no different than injecting regular or support Fragments
. I created an [ISSUE] for your question, which I have answered in this [PR], which adds support for injecting DialogFragments
in the companion GitHub project for this article.
If you already have a project using Dagger 2.11 setup, you would most likely only need to change 1 line of code in order to support injecting DialogFragments
. That is, you would need to either have your BaseFragment
subclass DialogFragment
instead of Fragment
OR subclass DaggerDialogFragment
introduced in Dagger 2.12.
Here is a screenshot of the [PR] description if you want a quick peek.