Multiple component provided by Activity
Author: ShyriCreated Jan 8, 2016Updated Sep 8, 2024
Labelsquestiondiscussion
The current implementation allows an Activity to provide a component to any subclass implementing HasComponent<C> interface. For instance UserListFragment.java
private void initialize() {
this.getComponent(UserComponent.class).inject(this);
this.userListPresenter.setView(this);
}But what about further fragments inside the same Activity. Imagine I want to add some OtherFragment.java later in the same Activity, which needs some OtherComponent. As the Activity can implement HasComponent<C> for only one type it cannot provide OtherComponent to the new Fragment.
I'm new to android-clean-architecture and maybe I'm missing something. Maybe this is not the propper way to achieve what I want, any advice?
Thanks!
Source: android10/Android-CleanArchitecture