Hi,
Is there any reason for using a module and a component for every activity/fragment?
One explanation would be to prevent unintended usage of some classes, but does it worth it?
Thank you
As an app grows it is nice to have the separation of dependencies for each UI elemnent. We are currently migrating to the new Dagger-Android constructs which will auto generate the subcomponents for each activity and fragment. While you may not need it in every app, we wanted to show what a setup looks like that has a separate module for each activity. Feel free to share an ActivityModule or a FragmentModule between many activities or fragments if you are not managing many dependencies that differ.
Most helpful comment
As an app grows it is nice to have the separation of dependencies for each UI elemnent. We are currently migrating to the new Dagger-Android constructs which will auto generate the subcomponents for each activity and fragment. While you may not need it in every app, we wanted to show what a setup looks like that has a separate module for each activity. Feel free to share an
ActivityModuleor aFragmentModulebetween many activities or fragments if you are not managing many dependencies that differ.