7

How does android:taskaffinity attribute work?

As per my understanding, pressing the Home key will move the activity to back stack, but it will not be destroyed. I am confused.

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
user1933455
  • 71
  • 1
  • 3

1 Answers1

-1

You indeed set a diffrent android:taskAffinity for activity2 and for the other activities. This will force android to make a diffrent 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 the

  1. Start activity2.
  2. press Home
  3. Start activity1.
  4. Press back -> the homescreen should be showed.