Skip to content

Instantly share code, notes, and snippets.

@larkintuckerllc
Created November 29, 2017 00:55
Show Gist options
  • Save larkintuckerllc/6d30f68bef90a8ebf4443af56b6f322d to your computer and use it in GitHub Desktop.
Save larkintuckerllc/6d30f68bef90a8ebf4443af56b6f322d to your computer and use it in GitHub Desktop.
How-to Dagger 2 with Android: Part 2 - 2
...
public class MyApplication extends Application {
private MyComponent mMyComponent;
@Override
public void onCreate() {
super.onCreate();
mMyComponent = createMyComponent();
}
MyComponent getMyComponent() {
return mMyComponent;
}
private MyComponent createMyComponent() {
return DaggerMyComponent
.builder()
.myModule(new MyModule())
.build();
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment