Android Application Layer source code reading notes -- Application

Source: Internet
Author: User

Android Application Layer Source Code Reading Notes-Application Introduction

In this year, have you ever seen the android source code? You must be sure to ask whether you have read the code on the android linux layer. If you have not read the code, you may feel embarrassed to say that you have learned android. I just thought about it. The code on the android linux layer is for a person who has never been engaged in linux, c/c ++, for a person from c #, java, python, what does js mean to android learners? Is it true that I will compile a C language with gcc, and then apply a patch on the kernel to implement a Shutdown Alarm? With limited capabilities, you can take notes on the source code of the application layer.

Start of a program --- Application

What? Is the start of a program activity? Let's take a look at how the source code is handled.

Application source code transfer door https://github.com/android/platformFrameworksBase/blob/master/core/java/android/app/Application. java

Applcation is the beginning of our android Application. No matter whether you know this class before, it silently completes the initialization of the android program... then we started our activity. the source code is quite understandable:private ArrayList<ComponentCallbacks> mComponentCallbacks = new ArrayList<ComponentCallbacks>(); private ArrayList<ActivityLifecycleCallbacks> mActivityLifecycleCallbacks = new ArrayList<ActivityLifecycleCallbacks>();

At the end of the Code, there are two methods for obtaining all the callbacks: collectXXXXXXXX (). This is easy to understand and cannot be explained.

The application uses two arraylists to manage the lifecycle of our components and activities. Let's take a look at them (where can we see them? The above portal is not going ?) ActivityLifecycleCallbacks. Are you familiar with it! It's not just the things of the activity we learned at the beginning. All the starting points are defined here. The next step is to register and remove components. You can see it clearly.

Next, let's take a look at the internal api!

Except for the attach at the beginning, you will see a bunch of Methods Starting with dispatch XXX. If you look up the dictionary, you will find that "scheduling, allocation means that these Apis control all of us! The start of activity is here!

No ..

If you look at the source code from the application, you will not feel so desperate. We suggest you read the application layer from here to gain confidence .. next time, let's talk about the core part of the android app: What is Context ..

This article is from the "game a chai" blog, please be sure to keep this source http://youxilua.blog.51cto.com/3357586/1064427

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.