First, Android system architecture
The Android system has a total of 4 layers from the bottom up and each layer encapsulates the underlying implementation and exposes the calling interface to the previous layer.
- Linux kernel (Linux Kernel)
- Android runs on Linux kernel 2.6, but replaces the Linux-bound part of the GNU protocol so that Android programs can be used for commercial purposes.
- The Linux kernel is the abstraction layer between the hardware and software layers.
- Middleware
- Middleware includes two parts: Core Library and runtime (libraries & Android Runtime)
- The core library includes the Surfacemanager Display System Management Library, which is responsible for displaying 2D or 3D content to the screen; Media Framework Library, which is responsible for supporting images, supporting the recording and playback of multiple video and audio; SQLite database, A powerful lightweight embedded relational database, WebKit browser engine, etc.
- Dalvik virtual machines: Unlike Java virtual machines, each Android application runs in its own process and has a Dalvik virtual machine of its own, which allows the system to be optimized at runtime and significantly reduces the impact between programs. Instead of running Java bytecode, the Dalvik virtual machine runs its own bytecode.
- Application Framework (Application framework)
- A rich and extensible view (views) that can be used to build applications, including lists (lists), grids (grids), TextBox (text boxes), buttons (buttons), and web browsers that can be embedded.
- Content Providers enables an application to access data from another application, such as a contact database, or to share its own data.
- The Resource Manager (Resource Manager) provides access to non-code resources, such as local strings, graphics, and layout files (layoutfiles).
- The Notification Manager (Notification Manager) enables applications to display customized prompts in the status bar.
- Activity Manager is used to manage the application lifecycle and to provide common navigation fallback functionality.
- Applications (applications)
- Android system will include some application packages including email client, SMS short message program, calendar, map, browser, contact management program and so on. All applications are written in the Java language.
Second, Android application structure analysis
1. We see a R.java file under the Gen directory, the R file is automatically generated by ADT, and the programmer does not need to modify it, and the R file is responsible for invoking the non-code resources in the application.