DJ-DOO DJ-DOO - 1 month ago 21
Android Question

MVP Android - How many presenters?

I have a quick question. I am trying (and struggling) to design my application with the MVP design pattern.

Can I ask, for each view (activity, fragment) should I have a separate presenter class?

There aren't very many resources I can see online, that clearly with samples illustrate the MVP. Could anyone share if they have some?

PS I am also using RecyclerViewAdapter in this app so any pointers on that would be appreciated

Thanks in advance

Answer

The Model-View-Controller design emerged very early in softwaredesign and was originally used for such things as an button element. You use the MVP(basically the same as MVC) in order to achieve an architecture which is modular and thus easy to maintain, spliting the representation from the logic.

Given your question i think you want indeed one Class per View. This would be the most common approach.

http://antonioleiva.com/mvp-android/ gives a theoretical overview of the MVP.

Comments