dependency injection - How to inject context using RoboGuice in Android? -
I would like to inject my references to my utility classes, I have seen the use of static fields, do so Are there any methods with static fields?
I use it to inject the context in order to use it.
Public Class MyClass {Private Provider & lt; Context & gt; ContextProvider; Remove the @Public MyClass (provider & lt; context> reference provider) {this.contextProvider = contextProvider; } Public doSomething () {reference c = contextProvider.get (); }}
Comments
Post a Comment