android:process用法

1.做用

android:process將組件在新進程中運行.html

2.應用範圍 

能夠出如今<application>  <activity><service><receiver>, and<provider>,<application> 中是全部組件的默認值,它們都在新進程中運行.android

     <activity
            android:name=".NewProcessAty"
            android:label="@string/title_activity_new_process_aty" 
            android:process=":ProcessName">
        </activity>

 

3.android:process的值

  它的值是個字符串.在<application>  <activity><service><receiver>, and<provider>中基本相同.新進程的名字.以":"開頭.
app

android:process在<application> 標籤語法介紹中的描述

  android:processThe name of a process where all components of the application should run. Each component can override this default by setting its own process attribute.ide

  By default, Android creates a process for an application when the first of its components needs to run. All components then run in that process. The name of the default process matches the package name set by the <manifest> element.ui

  By setting this attribute to a process name that's shared with another application, you can arrange for components of both applications to run in the same process — but only if the two applications also share a user ID and be signed with the same certificate.this

  If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed. If the process name begins with a lowercase character, a global process of that name is created. A global process can be shared with other applications, reducing resource usage.spa

android:process在<activity>標籤語法介紹中的描述

  android:processThe name of the process in which the activity should run. Normally, all components of an application run in a default process name created for the application and you do not need to use this attribute. But if necessary, you can override the default process name with this attribute, allowing you to spread your app components across multiple processes.code

  If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed and the activity runs in that process. If the process name begins with a lowercase character, the activity will run in a global process of that name, provided that it has permission to do so. This allows components in different applications to share a process, reducing resource usage.component

  The <application> element's process attribute can set a different default process name for all components.orm

android:process在<provider>標籤語法介紹中的描述

  android:processThe name of the process in which the content provider should run. Normally, all components of an application run in the default process created for the application. It has the same name as the application package. The <application> element's process attribute can set a different default for all components. But each component can override the default with its own processattribute, allowing you to spread your application across multiple processes.

If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed and the activity runs in that process. If the process name begins with a lowercase character, the activity will run in a global process of that name, provided that it has permission to do so. This allows components in different applications to share a process, reducing resource usage.

android:process在<receiver>標籤語法介紹中的描述

  android:processThe name of the process in which the broadcast receiver should run. Normally, all components of an application run in the default process created for the application. It has the same name as the application package. The <application> element's process attribute can set a different default for all components. But each component can override the default with its own processattribute, allowing you to spread your application across multiple processes.

If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed and the broadcast receiver runs in that process. If the process name begins with a lowercase character, the receiver will run in a global process of that name, provided that it has permission to do so. This allows components in different applications to share a process, reducing resource usage.

android:process在<service>標籤語法介紹中的描述

  android:processThe name of the process where the service is to run. Normally, all components of an application run in the default process created for the application. It has the same name as the application package. The <application> element's process attribute can set a different default for all components. But component can override the default with its own process attribute, allowing you to spread your application across multiple processes.

If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed and the service runs in that process. If the process name begins with a lowercase character, the service will run in a global process of that name, provided that it has permission to do so. This allows components in different applications to share a process, reducing resource usage.

相關文章
相關標籤/搜索