Android MVP mode first known-1

Source: Internet
Author: User

1. Introduction to the MVP

There are more than the introduction of the Internet, here said at the beginning of the time did not understand the meaning of the figure (online search)

2. In fact, in the code, the expression is that in presenter this implementation class will have a iview interface object and a Imodel interface object, through the two interface objects to invoke the method, so that the separation between the view and model is realized, They're working with each other through this presenter object.

In this presenter, a method is called, the data obtained from the Imodel object gets data and the view method that needs the data in iview is passed, and the following code calls the Imodel object's method of loading data in presenter. When the load succeeds, the loaded data is passed to the IView object, and the IView object calls the method that receives the data (usually the IView object is the activity or fragment view) and assigns the received data to the child controls that it corresponds to.

The following is the code that assigns a value to a child view in the IView class

Here's how to load data in a Imodel implementation class

3. The order in which data is transmitted above is

Android MVP mode first known-1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.