How does android: taskaffinity work?

How does the android:taskaffinity attribute android:taskaffinity ?

According to my understanding, pressing the Home key will move the operation back to the stack, but it will not be destroyed. I'm confused.

+7
source share
1 answer

You really installed a different android: taskAffinity for activity2 and for other actions. This will force the android to make another stack when (see My example).

  <activity android:name=".activity2" android:taskAffinity="com.example.act2" > </activity> <activity android:name=".activity1" android:taskAffinity="com.example.act1" > </activity> 

The following sequence should be correct. for

  • Launch Activity 2.
  • click home
  • Launch Activity 1.
  • Click Back β†’ the desktop should be displayed.
-one
source

All Articles