Skip to content

Instantly share code, notes, and snippets.

@larkintuckerllc
Created November 27, 2017 01:13
Show Gist options
  • Save larkintuckerllc/c6a4310944ca01fa066973f1a004151f to your computer and use it in GitHub Desktop.
Save larkintuckerllc/c6a4310944ca01fa066973f1a004151f to your computer and use it in GitHub Desktop.
How-to Dagger 2 with Android: Part 1 - 10
import android.app.Application;
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