Android basic knowledge induction and summary (1)
1: Why is android based on the linux platform?
Android is a linux kernel + function library + upper-level Virtual Machine System. For all mobile phone users, while requiring the mobile phone to provide reliable language communication, but also to obtain data-related cool features, Linux can meet these needs of users. On the other hand, another advantage of Linux as the stack Foundation of the Android platform is that it provides a hardware abstraction layer. The upper-layer software remains unchanged when underlying hardware changes.
Therefore, android is based on Linux, but android is not the same as the GNU/Linux design as the Linux release on PC. Because he has his own function libraries, service programs, and others, he does not use many GNU project programs.
2: What is android's philosophy?
Provide information to everyone anytime, anywhere
3: Composition of android applications
Generally, the android program consists of the following four parts:
Activity
Broadcast Intent Receiver er
Service
Content Provider
Q5: What is Intent?
Intent is an abstraction of the operations to be executed in android. It is a collection of actions and content. In Android, Intent is used to switch between screens.
A typical android Application consists of two parts: Activity and View object running on the foreground, and Intent and Service object running on the background. The Activity basically corresponds to the user interface screen, and the view corresponds to the user interface component. During User Screen interaction, the screen usually represents a task. After each screen completes its own task, the work is handed over to another component through Intent to execute a task.
Intent can be divided into two types: "Default Intent" and "Custom Intent ". Generally, the Intent written by developers in a program is defined by a custom Intent, such as switching Activity and passing various data. Data transmission between activities can also be divided into "Transfer Data" and "receive data ".
Q6: An Important Android file AndroidMainfest. xml file
The AndroidMainfest. xml file is created under the root directory of the application, and contains all the design-time relationships between the specific application and the Intent. Serves as the deployment descriptor for Android applications
The AndroidMainfest. xml file is a required file in every android program. The specific Parsing is as follows:
All content is included in the <mainfest> label. "package" indicates that the application is stored in the current namespace/path. "android: versionName = "1.0" is the version number for users
"Android: versionCode =" 1 "is the application version number.
The "application" label defines the Activity and service information used by this program.
Q7: android Lifecycle
First. The lifecycle of Android is managed by the android framework, rather than applications.
Android has seven statuses, which can be divided into three categories.
Resource allocation
Create Destory
The complete lifecycle begins with create and ends with destory. Allocate resources when creating create, release resources when destory
Visible and invisible
Start Restart Stop
When the activity runs to the start state, you can see the current activity on the screen. When the activity runs to the stop state, the activity disappears from the screen. As long as the activity is not destroyed, when the activity is called again, it will first enter the restart state and enter the normal start state.
Can users access the screen directly?
Resume Pause
When messages such as "toast", "alertdialog", and text messages break into, the original activity enters the pause status and temporarily gives up direct access to the screen. However, after an event with a higher priority is processed, the activity enters the resume status.
Induction of the Activity running process
Generally started
Oncreate ---- onstart ---- onresume
Call another activity
Onpause (1) ---- oncreate (2) ---- onstart (2 ---- onresume (2) ---- onstop (1)
Returns the original activity.
Onpause (2) ---- onrestart (1) ---- onstart (1) ---- onresume (1) ---- onstop (2) ----- ondestory (2)
Exit ended
Onpause () ---- onstop () ---- ondestory ()
Start after recycling
Oncreate --- onstart --- onresume
This article is from the "HDDevTeam" blog