Android:Task Affinity:[string]

The task that the activity has an affinity for. Activities with the same affinity conceptually belong to the same task (to the same "application" from the user's perspective). The affinity of a task is determined by the affinity of its root activity.

The affinity determines two things — the task that the activity is re-parented to (see the allowTaskReparenting attribute) and the task that will house the activity when it is launched with the FLAG_ACTIVITY_NEW_TASK flag.

By default, all activities in an application have the same affinity. You can set this attribute to group them differently, and even place activities defined in different applications within the same task. To specify that the activity does not have an affinity for any task, set it to an empty string.

If this attribute is not set, the activity inherits the affinity set for the application (see the <application> element's taskAffinity attribute). The name of the default affinity for an application is the package name set by the <manifest> element.

有相同亲和力的Activity从概念上来讲,它们属于同一个Task,从用户的角度来讲,也就是属于同一个应用。这个属性决定了两件事:1> 当这个Activity在reparent的时候,它应该加入到哪个Task当中; 2> 当启动这个Activity的Intent中带有FLAG_ACTIVITY_NEW_TASK的flag的时候,这个Activity应该加入到哪一个Task当中(也可能会创建一个新的Task)。如果这个属性设置为一个空字符串(android:taskAffinity=""),那就表示这个Activity不属于任何一个Task,换句话说,每次启动这个Activity时,都会创建一个新的Task。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值