It's my belief that the Presenter is the one responsible for handling the navigation aspect of a MVP application. Is this true or are there exceptions?
问题:
回答1:
You are right. The model cannot do it, and the view cannot do it.
In my apps, navigation is handled by cascading from the largest presenters to the smaller ones. For instance the overall app presenter gets the whole location, parses it, and sends any relevant pieces to the next presenter for finer-grained detail.
回答2:
I think the view is the only one responsible for the screen navigations. Here we have a good explanation about this "Android-MVP problem" and I have two reasons to think in this way:
1 - Basically for me the screen transitions are not more than a behaviour of views. it belongs of the view state. We know the presenter have to controls the view state through view methods, but is the view that implements this transitions in fact (calling startActivity, for example).
2 - The navigation between screens have some Android SDK dependencies, such as Intents, Bundles, FragmentsManagers, etc... And if you want to use MVP + Clean Architecture (strongly recommended), you "can't" share android dependencies between your presenters, because they should be java only to make the unit tests easier.