Created
December 7, 2014 13:30
-
-
Save JorgeCastilloPrz/9107b6c3d2e04cfa927e to your computer and use it in GitHub Desktop.
Graph construction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApplicationClass extends Application { | |
private ObjectGraph objectGraph; | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
objectGraph = ObjectGraph.create(getModules().toArray()); | |
objectGraph.inject(this); | |
} | |
protected List<Object> getModules() { | |
return Arrays.asList( | |
new GlobalModule(), | |
new AppModule(), | |
new ContextModule(this) | |
); | |
} | |
public void inject(Object className) { | |
objectGraph.inject(className); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment