The MVP architecture

The MVP architecture consists of three components:
  • Model represents the datasource. This layer is accessed to update/store and retrieve the data.
  • View usually implemented by an activity, has a one-to-one relationship with the Presenter
  • Presenter decides which methods from the view to call, and what will be displayed in the view.

Difference MVVM and MVP

In MVVM the ViewModel exposes it's methods and variables for the View to use it. In MVP the Presenter has a one-to-one relationship with the View, and decides what the view should do.

Example

We created a simple MVP example. As you can see, whenever a button is clicked, the Presenter decides what happens on the View. The presenter sets the progressbar on the view, and removes it.
Login event diagram
Checkout the github page to view the full repository.