Android and Advanced Learning --TaskAffinity allowTaskReparenting

For daily work, it may be four promoters mode android system has been able to meet our needs a bit more complex functions such as back-end call a designated page, send an address to the mobile terminal through the lower end Server, resolve action Once the information through the scheme protocol, you can complete the jump.

Today, when looking at the development of artistic exploration of Android saw a point of knowledge, not previously encountered, it is TaskAffinity and allowTaskReparenting

Let me talk TaskAffinity: This parameter default is the name of our package and the same, of course, can also be added manually to the current package name, but doing so may not be useful. In general, TaskAffinity singgleTask and is used to match and allowTaskReparenting.

When used in conjunction with TaskAffinity and singgleTask, it is a currently the name of the task stack mode Activity, Activity will be run at the start of the same name and TaskAffinity task stack.

When TaskAffinity and allowTaskReparenting combination, if A C activity B starts the application, this time A and C are in the same task stack, this time if you start by clicking on the B icon, then B, C will return B's task stack. The reason for this is because when C is activated, as is the start of A, so A can only be in the same task stack (at this time of taskAffinity C belongs to the package name of the application B), when clicked B app, C will find that they need the task stack was built, so it will automatically return to the task stack B APP.

Published 41 original articles · won praise 8 · views 20000 +

Guess you like

Origin blog.csdn.net/huma8848888/article/details/102785807