Android Basics Learning

Source: Internet
Author: User

IPC (inter-process communication) means that inter-process communication refers to the process of data exchange between two processes.

How do I open multiple processes in Android?

You only need to assign the Android:process attribute to the four components (Activity, Service, Receiver, ContentProvider) in Android Menifest .

Different process components have independent virtual machines, application, and memory space, and intuitively understand the equivalent of two different UID applications.

In different processes, the presence of in-memory data is non-disruptive and has no effect on other processes.

Problems caused by multiple processes:
1, static member variables, singleton mode, and so on, the data in memory is completely invalid.
2, application will create multiple
3. Thread synchronization is completely invalid

Intent intention, intention

Although the intent component is not the four components, but it is the bridge connecting the four components, learning this knowledge, it is also very important.

Intent is a runtime binding mechanism that connects two different components in the course of a program's operation. With intent, your program can express some kind of request or intention to Android, and Android will choose the appropriate component to respond to the desired content.

Figure 1-1 Communication via intent

If Activity1 need to contact Activity2, they do not need to contact directly, but through intent as a bridge.

Intent consists of the following components:

    1. Component (component): Destination component
    2. Action: An act used to express intention
    3. Category (category): The categories used to represent actions
    4. Data (data): Represents the action to be manipulated
    5. Type (data type): Description of the data paradigm
    6. Extras (Extended information): Extended information
    7. Flags (flag bit): The mode of operation that expects this intent

The intent type is divided into explicit intent (direct type), implicit intent (indirect type). The official recommendation is to use an implicit intent. In the above attributes, the component property is a direct type and the others are indirect types.

Implicit intnet is a lot more subtle than the explicit intent, which does not explicitly indicate which activity we want to start, but instead specifies a series of more abstract actions and category information, which is then referred to the system to analyze the intent. and help us find the right activity to start.

Android Basics Learning

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.