How does android:taskaffinity work?
Asked Answered
E

1

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.

Eisenach answered 7/1, 2013 at 5:14 Comment(0)
T
-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.
Trochilus answered 30/1, 2013 at 10:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.