In my working project, the senior Android developer developed the code structure so that each screen is a fragment, however each fragment has its own activity in which it is located. Activity does nothing but hold onto the corresponding fragment. It makes no sense to me.
I once implemented a function containing 4 screens using the following template when I first started working on this project: Step A: fragment A (screen 1), fragment B (screen 2), fragment C (screen 3), fragment D (screen 4) running in this thread, coming from ABCD, so I would replace the fragments as part of action A
The senior developer reorganized the code to make it as follows: Activity A with fragment A โ Activity B with fragment B โ ..etc
I asked him why this approach is better than the one I implemented. His argument was that it is more modular if in the future the application will be ported to the tablet, and the stack manager of this fragment will be an error and not easy to use for reverse navigation. I did not quite understand his explanation of why it is better, because popupbackstack seems to work fine. For me, it is much cleaner to have 1 activity for a certain function of the application and change all the associated screens for this function (fragment) inside and outside as part of the action.
I am also starting to work on a personal android application, and before I do this, I want to know what is actually the right way to do this. And if there is no right way, what are the pros and cons of each approach?