How Android Sees Your Activities

Let’s look at what is going on OS-wise as you move between activities. First, when you click on the GeoQuiz app in the launcher, the OS does not start the application; it starts an activity in the application. More specifically, it starts the application’s launcher activity. For GeoQuiz, MainActivity is the launcher activity.

When the New Project wizard created the GeoQuiz application and MainActivity, it made MainActivity the launcher activity by default. Launcher activity status is specified in the manifest by the intent-filter element in MainActivity’s declaration (Listing 6.18).

Listing 6.18  MainActivity declared as launcher activity (manifests/AndroidManifest.xml)

<manifest xmlns:android="http://schemas.android.com/apk/res/android" ...

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.