The question is published on by Tutorial Guruji team.
I started to learn MVP but I have a few questions related the Presenter. For example, if I have a really simple Activity that only displays a few information that I got from another Activity. At the moment I am just displaying the value without sending it to the Presenter.
Should I send the values to the Presenter so that the Presenter will call the methods in my Activity to display? Or can I just “ignore” the Presenter?
Answer
Should I send the values to the presenter and the presenter will call the methods in my activity to display?
You should.
Or can I just “ignore” the presenter?
You better should not.
One of the benefits of structuring your code using the MVP pattern is the ability to unit test the structural units. Any Presenter should be framework- (in Android, meaning view- ) independent which makes it possible to unit test it. So, if you “ignore” the Presenter you won’t be able to unit test the Activity methods invocations.
For commercial app development unit testing is a relevant part.