Vasiliy Zukanov
Jul 23, 2017 · 1 min read

While you did an outstanding job implementing this feature, I would strongly advice against its usage.

DI libraries (Dagger and others) should be used in order to inject dependencies into top level components only. All other objects should be injected using a simple constructor injection (or method injection in special cases).

In Android, top level components are Activity, Application, Service, Fragment and ContentProvider (possibly also BroadcastReceiver). All these components have access to Application object, therefore there is no need to complicate matters.

More detailed discussion available here.

    Vasiliy Zukanov

    Written by

    Software development consultant, freelance developer and blogger at www.techyourchance.com.