Android MVP design pattern

MVP definition?
M: Handling business logic and entity model
V: Corresponding to Activity, responsible for View drawing and user interaction
P: Responsible for completing the interaction between the View layer and the Model layer

Difference between MVP and MVC?
1) In the MVC design mode, the data model layer and the view layer can directly interact with the data, but the MVP cannot. In the MVP design mode, the data interaction between the model layer and the view layer is completed by the presenter.
2)
3)

How does MVP design a login interface?
First implement a get username, get user password, clear username, clear user password, show progressbar loading status, hide progressbar loading status, and jump to the main Activity and error callback

Login example:
Take a certain project of yours as an example. First, you must have a userbean class that manages basic user information, write basic attributes and corresponding get/set methods in the class, and extract the login into an interface (must be attribute name+password+server login information status callback), and implement it in Modle and interact with the server,

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325602929&siteId=291194637