问题
I'm working on an application and I need to make it possible to launch an activity in a separate history and stack as you can see in the photo that the application of the telephone starts the activity to make calls that works independently and even this can be observed when I want See recent apps.
回答1:
In the Manifest file for your application
In the <activity> element
Add an attribute: android:process=".ProcessName"
This will cause that particular activity to be launched in a new process.
For more details, search for "android:process" on this page
回答2:
use
android:launchMode="singleTask"
in activity node
details here:
Using the manifest file
Using Intent flags
回答3:
For creating a separate and independent history and stack, you need to set these flags :
Intent intent = new Intent(this,ActivityA.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_NEW_DOCUMENT |
Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
startActivity(intent);
In this manner, you have two sets of activities, with their own separate listing in the recent apps list.
来源:https://stackoverflow.com/questions/42424187/how-can-i-launch-an-independent-activity-to-my-application-as-well-as-the-applic