L
L
loly2016-06-03 04:06:07
Android
loly, 2016-06-03 04:06:07

How to implement persistent data access in MVP design pattern?

In the application I'm developing, each screen needs user data. Initially, it was planned to simply create a User class that would be created as needed in the necessary Presenters, but doing this in each of them again seems like a big mistake. How would you get out of this situation?
The User class contains the User model, from which it receives all the data.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
IceJOKER, 2016-06-03
@IceJOKER

singleton pattern?
Base Activity/Fragment class?

M
MikkiMouse, 2016-06-03
@MikkiMouse

I don't think referring to the model inside the User is a good idea.
The User object can be created in the model and requested by the desired presenter, which will already pass it to the view. The model itself may well be a singleton and store a reference to the User object, so as not to create it every time anew.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question