Skip to content

Instantly share code, notes, and snippets.

@JorgeCastilloPrz
Created December 7, 2014 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JorgeCastilloPrz/9107b6c3d2e04cfa927e to your computer and use it in GitHub Desktop.
Save JorgeCastilloPrz/9107b6c3d2e04cfa927e to your computer and use it in GitHub Desktop.
Graph construction
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