Android architecture and activity life cycle

Source: Internet
Author: User

Android's system architecture incorporates the idea of a layered architecture, as shown in 1. A total of four layers from the upper level to the bottom layer, namely the application program layer, the application framework layer, the system library and the Android runtime and the Linux kernel

Android 's system architecture diagram

Each layer features a brief introduction as follows:

an application layer

The tier provides core application packages such as e-mail, text messages, calendars, maps, browser and contact management. At the same time, developers can use the Java language to design and write their own applications, which are equal and friendly with those core applications.

Home: Homepage

Contacts: Contact App

Phone: Telephone

Browser: Browser app

Two application framework Layers

This layer is the basis for Android app development, and most of the time developers are dealing with her. The application framework layer includes the Activity Manager, window Manager, content provider, view system, Package Manager, Phone manager, resource manager, Location manager, Notification Manager, and XMPP Services 10 sections. On the Android platform, developers have full access to the API framework used by the core application. Also, any application can publish its own module of functionality, while other applications can use these published function modules. Based on this reuse mechanism, users can easily replace the various application components of the platform itself.

three system libraries and Android runtime

The system library consists of nine subsystems, layer management, Media Library, SQLite, Openglestate, FreeType, WebKit, SGL, SSL, and libc. The Android runtime includes both the core library and the Dalvik virtual machine, which are compatible with the function functions that most Java languages need to invoke, and the core libraries of Android, such as Android.os, Android.net, Android.media, and so on. The latter is a register-based Java Virtual machine, Dalvik virtual machine is to complete the life cycle management, stack management, thread management, security and exception management, garbage collection and other important functions.

Openglestate: Open Source project, dedicated to game development, 3D effects available to

Quad Linux kernel

Android Core system services rely on Linux2.6 cores such as security, memory management, process management, network protocol stacks, and drive models. The Linux kernel is also an abstraction layer for hardware and software stacks. Drivers: Display drivers, camera drivers, keyboard drivers, wifi drivers, audio drivers, flash memory drivers, Binder (IPC) drivers, power management, and more.

Summarize:

The 1 Android system architecture uses a layered architecture concept that is structured and structured to work together.

The 2 Android system Architecture not only recognizes the Android system from the macro level, but also gives us a direction for our learning and practice. If you're working on Android apps, you should study Android's application framework and application layer, and if you're working on Android, you should study Android's system library and Android runtime, and if you're working on Android-driven development, That should study Android's Linux kernel. In short, find the right entry point, practice the truth.

For example, to install alarms:

An application layer: Alarm App two application framework layer: Notification manager-> three system libraries and Android Runtime: Media framework-> four Linux cores: Audio Drivers

The process of launching the Android app is as follows:

When running our Android app, The Android operating system will first look for our androidmanifest.xml, this file is the main profile of our application, because we can have multiple activity in an application, which activity will we show first? This master profile defines the activity object that is currently loaded by the application by default, and when the activity object is found, it calls its OnCreate () method, which is primarily used to load our layout files, via Setcontentview () Method can be used to load the layout file we specify, and finally to display it on our screen according to the individual controls in the layout file. This is the activation process of our activity.

Activity Life cycle:


1. Start activity: The system calls the OnCreate method first, then calls the OnStart method, and finally calls Onresume,activity into the running state.

2. Current activity is overwritten or locked by other activity: the system invokes the OnPause method, pausing the execution of the current activity.

3. The current activity is returned to the foreground or unlock screen by the overwritten state: The system calls the Onresume method and enters the running state again.

4. The current activity goes to the new activity interface or press the home key to return to the main screen, itself back to the background: the system will first call the OnPause method, and then call the OnStop method, into a stagnant state.

5. The user backs back to this activity: the system calls the Onrestart method first, then calls the OnStart method, and finally calls the Onresume method, again into the running state.

6. Current activity is in a covered state or the background is not visible, that is, the 2nd and 4th steps, the system is out of memory, kill the current activity, and then the user returned to the current activity: Call OnCreate method Again, OnStart method, Onresume method To enter a running state.

7. The user exits the current activity: The system calls the OnPause method first, then calls the OnStop method, and finally calls the Ondestory method to end the current activity.

Finally, I enclose the structure of the teacher's class.

Android architecture and activity life cycle

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.