O
O
OM12017-01-13 14:59:22
Android
OM1, 2017-01-13 14:59:22

Android: how to use fragments with MVP model?

Hello.
The application is overgrown with fragments,
before that it used the fragment-> activity interfaces,
and immediately transferred it from the activity to the presenter, where it processed the call from the fragment interface.
Now the number of fragments has increased and the activity code begins to get clogged with the "crutches" of the work fragment->activity->presenter
How to correctly design work with fragments in the MVP model?
thank.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2017-01-13
@OM1

First, of course, you can look at clean architecture .
Secondly, if you use libraries like Mosby or Moxy, there are usually some examples there on how to work with this particular library.
Personally, I tend to think that a fragment is either a View and there is a Presenter for each fragment. Either this is an entity that is orthogonal to MVP, that is, does not directly relate to any of the letters, plays a "connecting" role. These two approaches are quite convenient to mix if necessary.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question