Study Notes on the principles of Android Application Framework 1

Source: Internet
Author: User

1. Understand two concepts: Abstraction and Derivation

Abstraction: Extracts commonalities from similar things and obtains a similar structure.

Derivative: Based on the abstract structure, add other functions to get specific things.

2. System OS, framework, and ApplicationProgram, Relationships between users

When a user operates a software program, there is actually another layer in the middle, that is, the system. For example, when a user clicks a button on the screen, the screen will be physically sensed, on the screen, this kind of physical sensing is handed over to the system OS for processing, the system generates corresponding event objects, and the framework is handed over to the corresponding program for corresponding processing, then, the event action is reversed to the screen.

Applications are managed by frameworks, such as Android, activity storage, opening and ending of programs, and so on.

Let's look at an example in reality:

The clerk is equivalent to the OS system, and the manager is equivalent to the Framework. The clerk communicates directly with the guest and solves the general problem on his own. Unless he encounters a problem that he cannot solve, he will ask the manager for help, A manager decides that in this figure, almost all the details of the interaction with the customer are handled by the clerk so that the manager becomes very easy, the relationship between the OS and the framework can also summarize the relationship between the framework and the application,

 

With the manager framework, the application becomes simple.

3. Features of the framework

3.1 functions in the framework can call functions in applications. In general, they call older generation. The framework was born before the program and is called a predecessor. The program was born on the basis of the Framework, so it is called the younger generation. When a senior calls a younger generation, it will produce the following effects:

3.1.1 many preset functions need to be defined in the framework, which can be called or rewritten by a work application.

3.2.2 The main role of programmers is to design various functions for the framework to call.

3.3.3 if the preset function is modified or replaced in the application, the Framework calls the function in the program, and vice versa.

3.2 typical two-way communication of the application framework

1. F1 () is preset in the framework, and F1 () is also defined in the program (). In this case, the F1 () function of the younger generation is preferentially called.
2. The framework "virtual" sets F2 (), that is, F2 () is an abstract function. You must
Define F2 () for Linux/Windows or other functions. For example, F3 () calls F2 ().
3. The frame presets F3 (), and the program does not define F3 (). Call the default F3 () function.
4. The frame presets F4 () and you have defined F4 (). In this case, the F4 () function is called first, while F4 () can call the F4 () function of the predecessor (preset.

 

Conclusion: we can see that the initiative between the framework and the application is in the hands of the box cutting, and the framework determines how to call functions in the application.

Related Article

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.