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?