The relationship between Activity and process

1. In the Android system, each application is composed of some Activity and Service.

2.Service runs in a separate process, while Activity may run in the same process or in different processes. Generally, all Activities of an application run in the same process.

3. If you want an Activity to run in a separate process, you need to configure the Activity's attribute Android:process = "value" in Androidmanifest.xml. The value of value is the process name of the process where the Activity is located. If the process name begins with ":", it is a private process; if the process name begins with a lowercase letter, it is a global process.

4. The communication between processes mainly relies on the binder mechanism.

5. The advantage of having some Activity run in a separate process is to reduce the coupling between different components in the entire application.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326802999&siteId=291194637