1. Please refer to one of the requirements of a well-known IT company's recruitment information: "familiar with the Android system architecture and related technologies, more than one year of practical Android platform development experience ;", it is clearly stated that the Android system architecture should be proficient. This illustrates the importance of understanding the Android system architecture to some extent. Let's take a look at the Android system structure diagram, which is derived from the android documentation:
Obviously, there are four main layers:
Linuxkernel: Responsible for hardware drivers, networks, power supplies, system security, and memory management.
Libraries and androidruntime: Libraries: C/C ++ function library. Most of them are open-source function libraries, such as WebKit, which are responsible for running Android web browsers, for example, the standard C function library libc, OpenSSL, SQLite, and so on, of course, also include support for game development 2dsgl and 3 dopengles, mediaframework framework is available in multimedia to support playback and display of various audio and video files, such as MPEG4 and H. 264, MP3, AAC, Amr, JPG, PNG, and many other multimedia file formats. Android Runtime is responsible for interpreting and executing the generated Dalvik format bytecode.
Applicationframework (Application Software Architecture), Java application developers mainly use the encapsulated API of this layer for rapid development.
Applications: This layer is the Java application layer. The Android built-in googlemaps, e-mail, instant messaging tools, browsers, MP3 players, and so on are on this layer, the programs developed by Java developers are also at this layer, which is equal to the built-in applications. You can call the built-in applications or replace the built-in applications.
The four layers above, the lower layer is the upper layer service, and the upper layer requires the lower layer support to call the lower layer service. This strict layering method brings great stability, flexibility, and scalability, this allows developers at different layers to focus on development at specific layers according to the specifications.
Android applications use framework APIs and run them under the Framework, which leads to a high degree of consistency in program development. On the other hand, it also tells us that, to write high-quality and efficient programs, you must have a deep understanding of the entire applicationframework. Proficient in applicationframework, you can truly understand the android design and operation mechanism, and control the development of the entire application layer.
2. Android officially recommends that the MVC mode be used for application development. What is MVC? First look
MVC is short for model, view, and controller. It can be seen that MVC consists of three parts:
L model object: it is the main part of an application. All business logic should be written in this layer.
L view object: the part of the application that generates the user interface. It is also the only layer that users can see in the entire MVC Architecture. It receives user input and displays processing results.
L controller (Control) objects: controls the display of user interface data and updates the state of Model Objects Based on user input. A more important navigation function of controller is that, if you want to use user-related events, you can submit them to m for handling.
Android encourages weak coupling and Component Reuse. In Android, MVC is embodied as follows:
1) view layer (View): it generally uses XML files to describe the interface, which can be easily introduced during use. Of course, if you know more about Android, you can think of using JavaScript + HTML as the view layer in Android. Of course, communication between Java and JavaScript is required. Fortunately, android provides convenient communication between them.
2) control layer (Controller): the important responsibilities of the control layer of Android usually fall on the shoulders of many acitores. This statement also implies that you should not write code in acitivity, another reason for this is that the response time of acitivity in Android is 5 S. If time-consuming operations are put here, programs are easily recycled.
3) model layer: database operations and network operations should all be processed in the model. Of course, operations such as business computing must also be placed in this layer.
3. Design Mode and IOC (control inversion)
There is no doubt that the reason why android can become an open and diversified system is inseparable from the exquisite application of the design model. As long as you observe it with a little attention, you will find that the combination of a design mode or design mode is everywhere in Android. the following design mode is something you must master to easily control Android:
Ltemplatemethod Mode
Lfactorymethod Mode
Lobserver Mode
Labstractfactory Mode
Ladapter Mode
Lcomposite Mode
Lstrategy Mode
Lstate Mode
Lproxy Mode
Lbridge Mode
Literator Mode
Lmediator Mode
LFA? Ade Mode
The charm of the android framework lies in IOC. During the development of Android, you will always feel the great convenience that IOC brings. For activity, the following functions are automatically called by the framework:
Protectedvoidoncreate (bundlesavedinstancestate );
Instead of actively calling the code, the code written by the user is called by the framework, which is reversed! Of course, the meaning of IOC itself is far more than that, but in this example, we can also see the huge benefits of IOC. Such examples can be seen everywhere in Android, for example, database management, for example, the call of the sax handler in Android. Sometimes, you even need to write a simple IOC implementation by yourself. The multithreading shown above is now a description.