MVC model in Android (composite mode)

Source: Internet
Author: User
MVC is an acronym for Model,view,controller, and MVC consists of three parts:

1. Model object: Is the main part of the application, and all business logic should be written on that layer.

2. View object: Is the part of the application that is responsible for generating the user interface. It is also the only layer that the user can see in the entire MVC architecture, receiving input from the user and displaying processing results.

3, controller (Control) object: is based on user input, control user interface data display and update Model object state part, controller more important a navigation function, want to use the user to start the related events, to M processing.

Android encourages weak coupling and component reuse, and MVC in Android is embodied in the following:

1, view: Generally use XML file interface description, when used can be very convenient to introduce, of course, how you learn more about Android, you can think of Android can also use javascript+ HTML and so on as the view layer, of course, there is a need for the communication between Java and JavaScript, fortunately, Android provides a very convenient communication between them implementation.

2, Control layer (Controller): The task of Android control layer usually falls on the shoulders of many acitvity, this sentence also implies do not write code in acitivity, to through activity delivery model business Logic layer processing, Another reason for this is that the response time of Acitivity in Android is 5s, and if time-consuming operations are put here, the program is easily recycled.

3, Model: the operation of the database, the operation of the network should be processed in the model, of course, business computing and other operations must be placed in the layer.

MVC is a composite pattern that may contain policy patterns, observer patterns, combinatorial patterns, singleton patterns, and so on, which are designed to understand decoupling and make programs easier to maintain and extend

MVC model in Android (composite mode)

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.