In android there are many different implementations for MVP. Most of them favor to use the Activity or Fragment as the view, a few would make them presenters, and even less, would separate the Activity or Fragment from the MVP, and have the classes related to Model, View, and Presenter reside inside the Activity or Fragment class.

The first 2 options seem to adapt the Android framework into becoming MVP, but the third option if applied correctly is creating the 3 layers inside the Android framework.

In Andorid-MVP the view is almost always recommended to be a passive view, and the Presenter as a middle-man between the model and the view. So having either be an Activity or Fragment, seems to give them more responsibility. On the other hand if MVP is inside an Activity or a Fragment, all three layers would need to communicate with the Activity or Fragment to get access to the system (get context, get resources, navigate, or trigger events based on life-cycle events).

Both have pros and cons, but which would adhere more to the rules of MVP?

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.