Android Context Creation Process

Source: Internet
Author: User

A specific resource or class that makes up the running context of an Android application

Packagemanager, ClassLoader, assert, etc.

The running context of the Android application window is described by the Contextimpl class, where each activity component is associated with a Contextimpl object. The Contextimpl class inherits the context class and its relationship to the activity component

This class diagram can be called decorative mode in design mode.

The activity component can then use this Contextimpl object to perform specific operations, such as starting the service component, registering the broadcast receiver, and launching the content provider component. At the same time, the Contextimpl class uses its own member variable Moutercontext to refer to an activity component associated with it, so that the Contextimpl class can also forward some operations to the activity component for processing.

In the previous Android application launch process source code Analysis article, we have analyzed the startup process of an activity component in detail. In this boot process, the final step is to create an activity instance in the application process through the member function of the Activitythread class Performlaunchactivity, and set the run context for it. That is, create a Contextimpl object for it. Next, we start with the member function performlaunchactivity of the Activitythread class, analyzing the creation of an activity instance so that we can understand the creation process of its running context:

Android Context Creation Process

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.