0
我有ApplicationComponent
提供ApiModule
和其他如何为其他片段提供匕首依赖?
@PerApplicationScope
@Component(
modules = {ApiModule.class, ApplicationModule.class}
)
public interface ApplicationComponent {
void inject(MainActivity activity);
}
我的应用程序的启动建设,这个组件,例如:
@Override
public void onCreate() {
super.onCreate();
component = DaggerApplicationComponent.builder()
.applicationModule(new ApplicationModule(this))
.apiModule(new ApiModule())
.build();
}
只有在我最初的片段可我得到响应某些API响应我可以创建Player
,应该在所有其他片段之间共享。
我该如何告诉Dagger有新的依赖项?