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?
相关问题
- Using the MVP pattern
- Models, Views, View Models and Presenters
- Mvp View knows Model
- Why declare a New Type within a VBA Class Module?
- Should I unit-test my view in MVP(or VM) or how to
相关文章
- In MVP, who should handle navigation?
- How to use empty view with pagination using paging
- MVP - Should the Presenter use Session?
- Sample MVC / MVP winforms Application (Non Trivial
- What is the legend of the arrows in these diagrams
- Clarification :MVC,MVP,MVVM
- GWT MVP architecture advantages
- Is ASP.net Model View Presenter worth the time?
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.
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.