O'Reilly logo

Android Programming: The Big Nerd Ranch Guide, Third Edition by Kristin Marsicano, Chris Stewart, Bill Phillips

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Starting an Activity

The simplest way one activity can start another is with the startActivity method:

    public void startActivity(Intent intent)

You might guess that startActivity(Intent) is a static method that you call on the Activity subclass that you want to start. But it is not. When an activity calls startActivity(Intent), this call is sent to the OS.

In particular, it is sent to a part of the OS called the ActivityManager. The ActivityManager then creates the Activity instance and calls its onCreate(Bundle) method, as shown in Figure 5.7.

Figure 5.7  Starting an activity

Illustration shows starting an activity.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required