Android Programming The Big Nerd Ranch Guide by Bill Phillips, Chris Stewart, Kristin Marsicano (z-lib.org)

(gtxtreme123) #1

Chapter 24  More About Intents and Tasks


Starting a new task


Sometimes, when you start an activity, you want the activity added to the current task. Other times, you
want it started in a new task that is independent of the activity that started it.


Right now, any activity started from NerdLauncher is added to NerdLauncher’s task, as depicted in
Figure 24.8.


Figure 24.8  NerdLauncher’s task contains CriminalIntent


You can confirm this by clearing all the tasks displayed in the overview screen. Then start
NerdLauncher and click on the CriminalIntent entry to launch the CriminalIntent app. Open the
overview screen again. You will not see CriminalIntent listed anywhere. When CrimeListActivity
was started, it was added to NerdLauncher’s task (Figure 24.9). If you press the NerdLauncher
task, you will be returned to whatever CriminalIntent screen you were looking at before starting the
overview screen.


Figure 24.9  CriminalIntent not in its own task

Free download pdf