3

My Activity A is opening Activity B in another task.
I'm trying to have only one task icon in task bar/recent apps.
Activity B is started with the following flags: Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NEW_TASK
In OS versions < 4.4 it works and only one task is shown in the task bar.
On OS >= KitKat you will see two icons in resent apps.

Code sample

    Intent activityBIntent;
    activityBIntent = new Intent(this, ActivityB.class);
    activityBIntent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(activityBIntent);
    finish();

ActivityB has affinity different than ActivityA:

    <activity
        android:name="com.bla.ActivityB"
        android:launchMode="singleTop"
        android:taskAffinity=""
        android:theme="@style/AppTheme.NoActionBar">
    </activity>

<activity
    android:name="com.bla.ActivityA"
    android:launchMode="singleTop"
    android:theme="@style/AppTheme.NoActionBar"
    android:windowSoftInputMode="adjustResize" >
</activity>

Any idea what can cause this? Any other workaround?

Nitz1
  • 31
  • 4
  • @Niz1 u got solution ? – nida Feb 21 '15 at 12:31
  • "I'm trying to have only one task icon in task bar/recent apps." This icon should represent which task? The one containing ActivityA or ActivityB? Also you should make sure (by providing a launcher icon) that the user has a way to get back to ActivityB if he leaves it by pressing the home button. – Vaishak Nair Dec 02 '15 at 08:25

0 Answers0