Skip to content

Instantly share code, notes, and snippets.

@frogermcs
Created October 18, 2016 13:55
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 frogermcs/8fbb97357819e6a276593bd30909fc48 to your computer and use it in GitHub Desktop.
Save frogermcs/8fbb97357819e6a276593bd30909fc48 to your computer and use it in GitHub Desktop.
public class MyApplication extends Application implements HasActivitySubcomponentBuilders {
@Inject
Map<Class<? extends Activity>, ActivityComponentBuilder> activityComponentBuilders;
private AppComponent appComponent;
public static HasActivitySubcomponentBuilders get(Context context) {
return ((HasActivitySubcomponentBuilders) context.getApplicationContext());
}
@Override
public void onCreate() {
super.onCreate();
appComponent = DaggerAppComponent.create();
appComponent.inject(this);
}
@Override
public ActivityComponentBuilder getActivityComponentBuilder(Class<? extends Activity> activityClass) {
return activityComponentBuilders.get(activityClass);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment