在安卓官方网站看到这段话:
However, you can arrange for different components in your application to run in separate processes, and you can create additional threads for any process
问:也就是说应用程序里每个组件都可以作为独立的进程来运行?
巴扎黑2017-04-17 12:03:23
在AndroidManifest.xml裡宣告元件的時候,加上process標籤並提供進程名,這樣就可以把這個元件放在另外的進程啟動了
// 把activity放在processName1进程
<activity android:name="packageName.xxxActivity" android:process=":processName1" />
// 把receiver放在processName2进程
<receiver android:name="packageName.xxxReceiver" android:process=":processName2" />