SlideShare a Scribd company logo
Managing Android
                          Back stack
                           Rajdeep Dua
                           June 2012




Monday, March 18, 13
Agenda
               •       Activity Back Stack explained

               •       Tasks

               •       Bringing activities to the foreground

               •       Modifying Activity launch behavior using manifest
                       le attributes

               •       Other advanced behaviors

                       •   No History

                       •   Task Reset

                       •   Task Affinity
Monday, March 18, 13
Android Back Stack


                       •   An Android application is composed of multiple
                           activities
                       •   New Activities are launched using Intents
                       •   Older ones are either destroyed or placed on a
                           back stack




Monday, March 18, 13
Android Back Stack

                       •   New Activity can be launched in the same task or
                           a new task
                       •   Back stack is a data structure which holds activities
                           in the background which user can navigate to using
                           back button.
                       •   Back Stack works in the last in first out mode.
                       •   It can be cleared in case of low memory




Monday, March 18, 13
Tasks

            •          Task is a collection of activities that user performs while
                       doing a job
            •          An activity is launched in a new task from the Home
                       screen
            •          By default all the activities in an application belong to the
                       same task
            •          Activities in a task can exist in the foreground,
                       background as well as on the back stack.



Monday, March 18, 13
Tasks




                       Activity A and Activity B are launched in Task A.
                       By default all activities in the same application
                       belong to a single task.

Monday, March 18, 13
Bringing Activities
                          to the Foreground
         •      Activities pop back to
                foreground as the user
                presses back button
         •      As an example in the
                gure
               •       Activity B gets
                       destroyed as soon as
                       user presses back
                       button
               •       Activity A comes to
                       the foreground
Monday, March 18, 13
Task in the Background




        •      Application 1 Launches in Task A
        •      Home Screen     Task A Goes to the Background
        •      Application 2 Launches in Task B in the foreground
Monday, March 18, 13
Modifying Activity Launch
                  Behavior using Manifest Flags




Monday, March 18, 13
Activity Launch Mode

                       •   Activities can be configured to launch with the
                           following modes in the Manifest le

                                  Use Case              Launch Mode

                                                         standard
                                   Normal
                                                         singleTop

                                                         singleTask
                                  Specialized
                                                       singleInstance




Monday, March 18, 13
Activity Launch Mode
                                standard
  <activity               android: launchMode=”standard”/>


   •       Default Launch
           Mode

   •       All the Activities
           belong to the
           same task in the
           application



Monday, March 18, 13
Activity Launch Mode
                                    singleTop
       <activity
           android:launchMode=”singleTop”/>

     •      Single instance of an
            Activity can exist at
            the top of the back
            stack

     •      Multiple instances can
            exist if there are
            activities between
            them



Monday, March 18, 13
Activity Launch Mode
                                 singleTask

      <activity android:launchMode=”singleTask”/>


     •      Activity is the root of a
            task

     •      Other activities are part
            of this task if they are
            launched from this activity

     •      If this activity already
            exists Intent is routed to
            that Instance


Monday, March 18, 13
Activity Launch Mode
                           singleTask...contd

     •      If this activity
            already exists
            Intent is routed to
            that instance and
            onNewIntent()
            Lifecycle method
            is called




Monday, March 18, 13
Activity Launch Mode
                                  singleInstance
     <activity
          android:launchMode=”singleInstance”/>

      •       Activity B is launched
              with launchMode
              singleInstance, it is
              always the only
              activity of its task




Monday, March 18, 13
SingleTop using Intent Flags

                •      Single Instance of an Activity at the top of the back
                       stack can also be achieved using Intent Flags.
         Step 1 : Create Activity A using an Intent with no flag


                 Intent intentA = new Intent(MainActivity.this,
                 ActivityA.class);
                 startActivity(intentA);


         Step 2 : Create Activity A again with the Intent flag FLAG_ACTIVITY_SINGLE_TOP
             Intent intentA = new Intent(MainActivity.this,
             ActivityA.class);
             intentA.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
             startActivity(intentA);


Monday, March 18, 13
Other Behaviors..

                       •   No History on the Back stack

                       •   Task Reset and clearing the
                           Back Stack

                       •   Task Affinity attribute in
                           Manifest




Monday, March 18, 13
No History on the Back Stack
   •       An Activity can be set to have no history on the back stack - it will be destroyed
           as soon as user moves away from it using the the intent flag
           FLAG_ACTIVITY_NO_HISTORY




Monday, March 18, 13
Clear Activity on Task Reset


         •      Activities can be cleared from the back stack when a
                task is reset.
              •        Use the Intent Flags FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
                       and FLAG_ACTIVITY_RESET_TASK_IF_NEEDED are used together
                       to clear activities on a task reset.

                       •   Flag FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET  to indicate
                           that the activity will be destroyed when the task is reset.

                       •   Flag FLAG_ACTIVITY_RESET_TASK_IF_NEEDED refers to the activity in
                           the back stack beyond which activities are destroyed.




Monday, March 18, 13
Clear Activity on Task Reset
                       ..contd




Monday, March 18, 13
Clear Activity on Task Reset
                               Sample Code

               //Code below shows how the Activity A gets launched with
               the appropriate flags.
               Intent intentA = new Intent(MainActivity.this,
               ActivityA.class);
               intentA.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED)
               ;
               startActivity(intentA);

               //sample code below shows the flag with with Activity B and
               Activity C get launched.
               Intent intentB = new Intent(ActivityA.this,
               ActivityB.class);
               intentB.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
               );
               startActivity(intentB);


Monday, March 18, 13
TaskAfnity

                •      Task Affinity can be used to launch activities in a new task, e.g
                       having two Launcher Activities which need to have their own task

                •      EntryActivityA and EntryActivityB will Launch in their own tasks




Monday, March 18, 13
TaskAfnity
                                              ..contd

                       •   EntryActivityA and EntryActivityB will Launch in
                           their own tasks

                       •   Manifest file entries for the two activities
                       <activity android:name=".EntryActivityA"
                               android:label="@string/activitya"
                               android:taskAffinity="stacksample.activitya">
                           <intent-filter>
                               <action android:name="android.intent.action.MAIN" />
                               <category android:name="android.intent.category.LAUNCHER" />
                           </intent-filter>
                       </activity>
                       <activity android:name=".EntryActivityB"
                               android:label="@string/activityb"
                               android:taskAffinity="stacksample.activityb">
                           <intent-filter>
                               <action android:name="android.intent.action.MAIN" />
                               <category android:name="android.intent.category.LAUNCHER" />
                           </intent-filter>
                       </activity>



Monday, March 18, 13
Summary


                       •   Default behavior of using the back stack serves
                           most of the use cases

                       •   Default behavior can be modified using Manifest
                           file attributes and Intent flags to launch activities in
                           their own task, having a single instance or having
                           no history




Monday, March 18, 13

More Related Content

What's hot (20)

PPTX
Exception Handling in Java
lalithambiga kamaraj
 
PDF
Spring Boot
HongSeong Jeon
 
PPTX
Angular Lazy Loading and Resolve (Route Resolver)
Squash Apps Pvt Ltd
 
PDF
Intents in Android
ma-polimi
 
PPTX
Introduction to iOS Apps Development
Prof. Erwin Globio
 
PPTX
History Of JAVA
ARSLANAHMED107
 
PDF
Android intents
Siva Ramakrishna kv
 
ODP
Spring User Guide
Muthuselvam RS
 
PPTX
Android Task Hijacking
Positive Hack Days
 
PPTX
Java 8 Lambda and Streams
Venkata Naga Ravi
 
PPTX
Java - Collections framework
Riccardo Cardin
 
PPTX
Writing and using Hamcrest Matchers
Shai Yallin
 
PDF
GraphQL IN Golang
Bo-Yi Wu
 
PPSX
Kotlin Language powerpoint show file
Saurabh Tripathi
 
PDF
Introduction to kotlin for android app development gdg ahmedabad dev fest 2017
Hardik Trivedi
 
PPTX
Applets in java
Wani Zahoor
 
PDF
JUnit 5
Scott Leberknight
 
PPTX
Java exception handling
Md. Tanvir Hossain
 
PDF
Android Threading
Jussi Pohjolainen
 
PPTX
Introduction to spring boot
Santosh Kumar Kar
 
Exception Handling in Java
lalithambiga kamaraj
 
Spring Boot
HongSeong Jeon
 
Angular Lazy Loading and Resolve (Route Resolver)
Squash Apps Pvt Ltd
 
Intents in Android
ma-polimi
 
Introduction to iOS Apps Development
Prof. Erwin Globio
 
History Of JAVA
ARSLANAHMED107
 
Android intents
Siva Ramakrishna kv
 
Spring User Guide
Muthuselvam RS
 
Android Task Hijacking
Positive Hack Days
 
Java 8 Lambda and Streams
Venkata Naga Ravi
 
Java - Collections framework
Riccardo Cardin
 
Writing and using Hamcrest Matchers
Shai Yallin
 
GraphQL IN Golang
Bo-Yi Wu
 
Kotlin Language powerpoint show file
Saurabh Tripathi
 
Introduction to kotlin for android app development gdg ahmedabad dev fest 2017
Hardik Trivedi
 
Applets in java
Wani Zahoor
 
Java exception handling
Md. Tanvir Hossain
 
Android Threading
Jussi Pohjolainen
 
Introduction to spring boot
Santosh Kumar Kar
 

Viewers also liked (20)

PDF
Basic Gradle Plugin Writing
Schalk CronjĂŠ
 
PPTX
An Introduction to RxJava
Sanjay Acharya
 
PDF
Streams, Streams Everywhere! An Introduction to Rx
Andrzej Sitek
 
ODP
Android Pro Tips - IO 13 reloaded Event
Ran Nachmany
 
PDF
PROMAND 2014 project structure
Alexey Buzdin
 
PDF
Code Signing with CPK
Zhi Guan
 
PDF
MidoNet deep dive
Taku Fukushima
 
PDF
Introduction to MidoNet
Taku Fukushima
 
PDF
Cloud Foundry Open Tour India 2012 , Keynote
rajdeep
 
PDF
RubyKaigi2014レポート
gree_tech
 
PDF
Gunosy.go #4 go
Taku Fukushima
 
PPTX
Openstack meetup-pune-aug22-overview
rajdeep
 
PPTX
Testing android apps with espresso
Édipo Souza
 
PDF
AML workshop - Status of caller location and 112
EENA (European Emergency Number Association)
 
PDF
Cloudfoundry Overview
rajdeep
 
PPTX
C# everywhere: Xamarin and cross platform development
Gill Cleeren
 
PDF
rtnetlink
Taku Fukushima
 
PPTX
Openstack Overview
rajdeep
 
PPTX
VMware Hybrid Cloud Service - Overview
rajdeep
 
Basic Gradle Plugin Writing
Schalk CronjĂŠ
 
An Introduction to RxJava
Sanjay Acharya
 
Streams, Streams Everywhere! An Introduction to Rx
Andrzej Sitek
 
Android Pro Tips - IO 13 reloaded Event
Ran Nachmany
 
PROMAND 2014 project structure
Alexey Buzdin
 
Code Signing with CPK
Zhi Guan
 
MidoNet deep dive
Taku Fukushima
 
Introduction to MidoNet
Taku Fukushima
 
Cloud Foundry Open Tour India 2012 , Keynote
rajdeep
 
RubyKaigi2014レポート
gree_tech
 
Gunosy.go #4 go
Taku Fukushima
 
Openstack meetup-pune-aug22-overview
rajdeep
 
Testing android apps with espresso
Édipo Souza
 
AML workshop - Status of caller location and 112
EENA (European Emergency Number Association)
 
Cloudfoundry Overview
rajdeep
 
C# everywhere: Xamarin and cross platform development
Gill Cleeren
 
rtnetlink
Taku Fukushima
 
Openstack Overview
rajdeep
 
VMware Hybrid Cloud Service - Overview
rajdeep
 
Ad

Similar to Managing Activity Backstack (20)

PPTX
Android Developer Training
faizrashid1995
 
PDF
Android platform activity
Hoang Vy Nguyen
 
ODP
Android App Development - 02 Activity and intent
Diego Grancini
 
PDF
Android Basic Components
Jussi Pohjolainen
 
PPTX
Android activity
MohNage7
 
PDF
The activity class
maamir farooq
 
PDF
The activity class
maamir farooq
 
DOCX
Android building blocks and application life cycle-chapter3
Dr. Ramkumar Lakshminarayanan
 
PDF
android_mod_3.useful for bca students for their last sem
aswinbiju1652
 
PDF
Android activity
Krazy Koder
 
PDF
Lecture 3 getting active through activities
Ahsanul Karim
 
PDF
Android development Training Programme Day 2
DHIRAJ PRAVIN
 
PPT
Day 4: Android: Getting Active through Activities
Ahsanul Karim
 
PPTX
Intents
maamir farooq
 
PPTX
Android activity intentsq
perpetrotech
 
PPTX
Android activity intents
perpetrotech
 
PDF
Dueling Banjos: Inter-app Communication
Mobile March
 
PPTX
Android development session 2 - intent and activity
Farabi Technology Middle East
 
PDF
[Android] Intent and Activity
Nikmesoft Ltd
 
ODP
Anatomy of android application
Nikunj Dhameliya
 
Android Developer Training
faizrashid1995
 
Android platform activity
Hoang Vy Nguyen
 
Android App Development - 02 Activity and intent
Diego Grancini
 
Android Basic Components
Jussi Pohjolainen
 
Android activity
MohNage7
 
The activity class
maamir farooq
 
The activity class
maamir farooq
 
Android building blocks and application life cycle-chapter3
Dr. Ramkumar Lakshminarayanan
 
android_mod_3.useful for bca students for their last sem
aswinbiju1652
 
Android activity
Krazy Koder
 
Lecture 3 getting active through activities
Ahsanul Karim
 
Android development Training Programme Day 2
DHIRAJ PRAVIN
 
Day 4: Android: Getting Active through Activities
Ahsanul Karim
 
Intents
maamir farooq
 
Android activity intentsq
perpetrotech
 
Android activity intents
perpetrotech
 
Dueling Banjos: Inter-app Communication
Mobile March
 
Android development session 2 - intent and activity
Farabi Technology Middle East
 
[Android] Intent and Activity
Nikmesoft Ltd
 
Anatomy of android application
Nikunj Dhameliya
 
Ad

More from rajdeep (12)

PDF
Aura Framework Overview
rajdeep
 
PPTX
Docker 1.5
rajdeep
 
PPTX
Docker Swarm Introduction
rajdeep
 
PPTX
Introduction to Kubernetes
rajdeep
 
PDF
Docker Architecture (v1.3)
rajdeep
 
PPTX
virtualization-vs-containerization-paas
rajdeep
 
PPTX
OpenvSwitch Deep Dive
rajdeep
 
PDF
Deploy Cloud Foundry using bosh_bootstrap
rajdeep
 
PDF
Cloud Foundry Architecture and Overview
rajdeep
 
KEY
Play Support in Cloud Foundry
rajdeep
 
PPT
Google cloud platform
rajdeep
 
PPT
Introduction to Google App Engine
rajdeep
 
Aura Framework Overview
rajdeep
 
Docker 1.5
rajdeep
 
Docker Swarm Introduction
rajdeep
 
Introduction to Kubernetes
rajdeep
 
Docker Architecture (v1.3)
rajdeep
 
virtualization-vs-containerization-paas
rajdeep
 
OpenvSwitch Deep Dive
rajdeep
 
Deploy Cloud Foundry using bosh_bootstrap
rajdeep
 
Cloud Foundry Architecture and Overview
rajdeep
 
Play Support in Cloud Foundry
rajdeep
 
Google cloud platform
rajdeep
 
Introduction to Google App Engine
rajdeep
 

Recently uploaded (20)

PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
July Patch Tuesday
Ivanti
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
July Patch Tuesday
Ivanti
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 

Managing Activity Backstack

  • 1. Managing Android Back stack Rajdeep Dua June 2012 Monday, March 18, 13
  • 2. Agenda • Activity Back Stack explained • Tasks • Bringing activities to the foreground • Modifying Activity launch behavior using manifest le attributes • Other advanced behaviors • No History • Task Reset • Task Afnity Monday, March 18, 13
  • 3. Android Back Stack • An Android application is composed of multiple activities • New Activities are launched using Intents • Older ones are either destroyed or placed on a back stack Monday, March 18, 13
  • 4. Android Back Stack • New Activity can be launched in the same task or a new task • Back stack is a data structure which holds activities in the background which user can navigate to using back button. • Back Stack works in the last in rst out mode. • It can be cleared in case of low memory Monday, March 18, 13
  • 5. Tasks • Task is a collection of activities that user performs while doing a job • An activity is launched in a new task from the Home screen • By default all the activities in an application belong to the same task • Activities in a task can exist in the foreground, background as well as on the back stack. Monday, March 18, 13
  • 6. Tasks Activity A and Activity B are launched in Task A. By default all activities in the same application belong to a single task. Monday, March 18, 13
  • 7. Bringing Activities to the Foreground • Activities pop back to foreground as the user presses back button • As an example in the gure • Activity B gets destroyed as soon as user presses back button • Activity A comes to the foreground Monday, March 18, 13
  • 8. Task in the Background • Application 1 Launches in Task A • Home Screen Task A Goes to the Background • Application 2 Launches in Task B in the foreground Monday, March 18, 13
  • 9. Modifying Activity Launch Behavior using Manifest Flags Monday, March 18, 13
  • 10. Activity Launch Mode • Activities can be congured to launch with the following modes in the Manifest le Use Case Launch Mode standard Normal singleTop singleTask Specialized singleInstance Monday, March 18, 13
  • 11. Activity Launch Mode standard <activity android: launchMode=”standard”/> • Default Launch Mode • All the Activities belong to the same task in the application Monday, March 18, 13
  • 12. Activity Launch Mode singleTop <activity android:launchMode=”singleTop”/> • Single instance of an Activity can exist at the top of the back stack • Multiple instances can exist if there are activities between them Monday, March 18, 13
  • 13. Activity Launch Mode singleTask <activity android:launchMode=”singleTask”/> • Activity is the root of a task • Other activities are part of this task if they are launched from this activity • If this activity already exists Intent is routed to that Instance Monday, March 18, 13
  • 14. Activity Launch Mode singleTask...contd • If this activity already exists Intent is routed to that instance and onNewIntent() Lifecycle method is called Monday, March 18, 13
  • 15. Activity Launch Mode singleInstance <activity android:launchMode=”singleInstance”/> • Activity B is launched with launchMode singleInstance, it is always the only activity of its task Monday, March 18, 13
  • 16. SingleTop using Intent Flags • Single Instance of an Activity at the top of the back stack can also be achieved using Intent Flags. Step 1 : Create Activity A using an Intent with no flag Intent intentA = new Intent(MainActivity.this, ActivityA.class); startActivity(intentA); Step 2 : Create Activity A again with the Intent flag FLAG_ACTIVITY_SINGLE_TOP Intent intentA = new Intent(MainActivity.this, ActivityA.class); intentA.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP) startActivity(intentA); Monday, March 18, 13
  • 17. Other Behaviors.. • No History on the Back stack • Task Reset and clearing the Back Stack • Task Afnity attribute in Manifest Monday, March 18, 13
  • 18. No History on the Back Stack • An Activity can be set to have no history on the back stack - it will be destroyed as soon as user moves away from it using the the intent flag FLAG_ACTIVITY_NO_HISTORY Monday, March 18, 13
  • 19. Clear Activity on Task Reset • Activities can be cleared from the back stack when a task is reset. • Use the Intent Flags FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET and FLAG_ACTIVITY_RESET_TASK_IF_NEEDED are used together to clear activities on a task reset. • Flag FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET  to indicate that the activity will be destroyed when the task is reset. • Flag FLAG_ACTIVITY_RESET_TASK_IF_NEEDED refers to the activity in the back stack beyond which activities are destroyed. Monday, March 18, 13
  • 20. Clear Activity on Task Reset ..contd Monday, March 18, 13
  • 21. Clear Activity on Task Reset Sample Code //Code below shows how the Activity A gets launched with the appropriate flags. Intent intentA = new Intent(MainActivity.this, ActivityA.class); intentA.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED) ; startActivity(intentA); //sample code below shows the flag with with Activity B and Activity C get launched. Intent intentB = new Intent(ActivityA.this, ActivityB.class); intentB.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET ); startActivity(intentB); Monday, March 18, 13
  • 22. TaskAfnity • Task Afnity can be used to launch activities in a new task, e.g having two Launcher Activities which need to have their own task • EntryActivityA and EntryActivityB will Launch in their own tasks Monday, March 18, 13
  • 23. TaskAfnity ..contd • EntryActivityA and EntryActivityB will Launch in their own tasks • Manifest le entries for the two activities <activity android:name=".EntryActivityA" android:label="@string/activitya" android:taskAffinity="stacksample.activitya"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".EntryActivityB" android:label="@string/activityb" android:taskAffinity="stacksample.activityb"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> Monday, March 18, 13
  • 24. Summary • Default behavior of using the back stack serves most of the use cases • Default behavior can be modied using Manifest le attributes and Intent flags to launch activities in their own task, having a single instance or having no history Monday, March 18, 13