Description
When delegating the responsibilities from the View to the Presenter a common pitfall is that the Presenter has to perform too many activities. Don’t let the Presenter have a direct connection with the database. Use are Repository to return the data. Keep presenters as simple as possible.
Example
We created a simple MVP login Application.
The only job of our Presenters is to provide the views with data received from the model. And handle each user-action accordingly.
In our case the data is also requested from the model, so it just has to wait, to present the view with the data. Also the received data is already formatted the way the MainPresenter and the MainView want it.
Instead of performing the data request to the database itself and transforming, ask the Interactor to perform the job. This way the Presenter only has one responsibility, that is decide what should happen in the view.
Check out the Github page to view the complete repository.