是否有可能启动一个活动作为一个新的过程

时间:2020-11-30 20:43:08

I have this situation where i have to start an activity from my mainActivity. But I want this new activity to be started as a new process(With new process ID). Is it possible to achieve this in android. Any help is appreciated.

在这种情况下,我必须从主活动开始。但是我希望这个新的活动作为一个新的进程(具有新的进程ID)启动。是否有可能在android中实现这一点。任何帮助都是感激。

1 个解决方案

#1


17  

Just put android:process=":ProcessName" for your Activity in AndroidManifest.xml

只需将android:process=":ProcessName"输入到android manifest .xml中

<activity
     android:name=".YourActivity"
     android:screenOrientation="portrait"
     android:process=":YourProcessName">
     <intent-filter>
          <action android:name="android.intent.action.VIEW" />

          <category android:name="android.intent.category.DEFAULT" />
     </intent-filter>
</activity>

In this case "YourActivity" will be run on other process called "YourProcessName".

在这种情况下,“YourActivity”将运行在名为“YourProcessName”的其他进程上。

#1


17  

Just put android:process=":ProcessName" for your Activity in AndroidManifest.xml

只需将android:process=":ProcessName"输入到android manifest .xml中

<activity
     android:name=".YourActivity"
     android:screenOrientation="portrait"
     android:process=":YourProcessName">
     <intent-filter>
          <action android:name="android.intent.action.VIEW" />

          <category android:name="android.intent.category.DEFAULT" />
     </intent-filter>
</activity>

In this case "YourActivity" will be run on other process called "YourProcessName".

在这种情况下,“YourActivity”将运行在名为“YourProcessName”的其他进程上。