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
Get Android Programming: The Big Nerd Ranch Guide, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.