Reference Link: http://www.runoob.com/android/android-architecture.html
http://www.runoob.com/android/android-application-components.html
Android Architecture
The Android operating system is a stack of software components that can be broadly divided into five parts and four main layers in the architecture diagram.
Linux kernel
At the bottom of all layers is Linux-including about 115 patches of Linux 3.6. It provides basic system functions such as process management, memory management, device management (e.g. camera, keyboard, monitor). At the same time, the kernel handles all the work that Linux does, such as the network and a large number of device drivers, to avoid the inconvenience of being compatible with a large number of peripheral hardware interfaces.
Library
On top of the Linux kernel layer is a collection of libraries, including the open source Web browser engine Webkit, the well-known libc library, the SQLite database for warehouse storage and application data sharing, a library for playing and recording audio and video, an SSL library for network security, and more.
Android Program Library
This category includes a Java-based library specifically developed for Android. Examples of this class library include application framework libraries, such as user interface building, graphical drawing, and database access. Some of the Android core libraries available to Android developers are summarized below:
- Android.app-Provides access to the application model and is the cornerstone of all Android applications.
- Android.content-facilitates content access between applications, application components, publishing, messaging.
- Android.database-Used to access data published by content providers, including SQLite database management classes.
- Java interface for Android.opengl-opengl ES 3D image rendering API.
- Android.os-provides applications with the ability to access annotated operating system services, including messaging, system services, and interprocess communication.
- Android.text-Renders and operates text on the device display.
- Android.view-the base building block of the application user interface.
- Android.widget-rich set of pre-built user interface components, including buttons, labels, lists, layout management, radio buttons, etc.
- Android.webkit-A collection of classes that allow the application to provide built-in WEB browsing capabilities.
Looking at the Java-based core library in the Android runtime, it's time to focus on the C + +-based library in the Android software stack.
Android runtime
This is the third part of the architecture, the bottom-up second tier. This section provides a key component called the Dalvik virtual machine, similar to a Java virtual machine, but designed and optimized for Android.
Dalvik virtual machines make it possible to use Linux core features in Java, such as memory management and multithreading. Dalvik virtual machines enable each Android application to run on its own standalone virtual machine process.
The Android runtime also provides a series of core libraries to write Android applications for Android application developers using the standard Java language.
Application Framework
The application framework layer provides many advanced services for applications in the form of Java classes. Application developers are allowed to use these services in the app.
- Activity Manager-Controls all aspects of the application life cycle and activity stack.
- Content providers-allows data to be published and shared between applications.
- Explorer-provides access to non-code-embedded resources, such as strings, color settings, and user interface layouts.
- Notification Manager-Allows the application to display a dialog box or notify the user.
- View System-an extensible collection of views that is used to create an application user interface.
Application
There are all Android apps in the top level. The application you write will also be installed on this layer. These apps include contacts, browsers, games, and more.
Android Application Components
Application components are the basic building blocks of an Android application. These components are loosely coupled by the application manifest file. Androidmanifest.xml describes each component of the application and how they interact.
The following are four major components that can be used in Android applications.
| Components |
Description |
| Activities |
Describes the UI and handles user interaction with the machine screen. |
| Services |
Handles background operations associated with the application. |
| Broadcast receivers |
Handles communication between the Android operating system and the application. |
| Content Providers |
Handle Data and database management issues. |
Activities
An activity identifies a single screen with a user interface. For example, a mail application can contain an activity to display a new mailing list, another activity to compose a message, and another activity to read the message. When an application has more than one activity, one of them is flagged for display when the application starts.
An activity is a subclass of the activity class, as follows:
public class Mainactivity extends Activity {}
Services
A service is a component that runs in the background and performs long operations. For example, a service can be a user playing music in the background while using a different program, or fetching data over the network in an activity without blocking user interaction.
A service is a subclass of the Services class, as follows:
public class MyService extends Service {}
Broadcast receivers
A broadcast receiver simply responds to broadcast messages sent from other applications or systems. For example, an application can initiate a broadcast to let other applications direct that some data has been downloaded to the device and can be used by them. Therefore, the broadcast receivers intercept these communications and take appropriate action.
A broadcast receiver is a subclass of the Broadcastreceiver class, and each message is broadcast in the form of an Intent object.
public class Myreceiver extends broadcastreceiver {}
Content Providers
The content provider component provides data from one application to another by requesting it. These requests are handled by the methods of the Contentresolver class. This data can be stored in a file system, database, or other place.
The content provider is a subclass of the ContentProvider class and implements a standard set of APIs for other applications to perform transactions.
public class Mycontentprovider extends contentprovider {}
We will cover the application components in separate chapters through the details of these tags.
Accessory Components
The components of some attachments are used for the entities mentioned above, the logic between them, and the construction of the wires between them. These components are as follows:
| Components |
Description |
| Fragments |
Represents a behavior or part of a user interface in an activity. |
| Views |
Draw UI elements on the screen, including buttons, lists, and so on. |
| Layouts |
View inheritance that controls screen formatting and shows the appearance of the view. |
| Intents |
The message lines between components. |
| Resources |
External elements, such as string resources, constant resources, and picture resources. |
| Manifest |
The configuration file for the application. |
Overview of Android development and related background knowledge