I have one app with two activities A & B, both with launch mode singleInstance. I notice that even if both A and B are running in the background, only the last activity is shown in recent-apps list. Is it possible to keep both A & B in the recent-apps list? Thanks.
Most apps contain multiple screens, which means they comprise multiple activities. Typically, one activity in an app is specified as the main activity, which is the first screen to appear when the user launches the app. Each activity can then start another activity in order to perform different actions.
From the Home screen, tap the Recents icon to the left of the Home button. All of your active or opened apps will be listed. If you've customized your Navigation bar, Recents may be located on the right, unless you're using full screen gestures. To open an app, simply tap it.
A task is a collection of activities that users interact with when trying to do something in your app. These activities are arranged in a stack—the back stack—in the order in which each activity is opened. For example, an email app might have one activity to show a list of new messages.
In the AndroidManifest, make sure to set the android:taskAffinity attribute of the element differently for each Activity. For example:
<activity
android:name="com.example.ActivityA"
android:label="Activity A"
android:launchMode="singleInstance"
android:taskAffinity="com.example.AffinityA" >
</activity>
<activity
android:name="com.example.ActivityB"
android:label="Activity B"
android:launchMode="singleInstance"
android:taskAffinity="com.example.AffinityB" >
</activity>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With