0

I'm using MVP model to develop a finance management app in Android Studio. I have two spinners and some kind of month picker (so to speak) to show transactions that have happened in that month.

So it's gonna have a lot of business logic and I was curious is it okay to have more than one presenter instance in one Activity.

One for account management, one to list all the transactions and one for the month picker logic.

ssemir99
  • 1
  • 2

2 Answers2

0

Generally speaking One Presenter is tied to One View.

You might wanna read some article on medium such as this one

Biscuit
  • 4,840
  • 4
  • 26
  • 54
  • Yeah I know that, but I was thinking about different types of Presenters. Like AccountPresenter, TransactionPresenter. – ssemir99 Mar 23 '20 at 21:38
  • It would be to go against the MVP pattern to use multiple presenter in one view, or the contrary one presenter for multiple view. – Biscuit Mar 23 '20 at 21:59
0

Yes you can use more than one Presenter per View, but first you should ask to yourself if you really need it.

This question/answer https://stackoverflow.com/a/44496711/1259555 use a good example of custom views with multiple Presenters.

Usually I use more than one Presenter if:

  • My Activity is too complex with a lot of independent components
  • The contract between Presenter and View is very concise
  • There's no async work between the Presenters
rafael
  • 732
  • 1
  • 11
  • 20