How can I launch an independent activity to my application as well as the application of phone launches the activity to make calls?

落花浮王杯 提交于 2020-05-16 13:53:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!