4.10 AndroidManifest.xml

Figure 4.45 shows the Flag Quiz app’s autogenerated manifest. Each Activity in an app must be declared in AndroidManifest.xml; otherwise, Android will not know that the Activity exists and will not be able to launch it. When you created the app, the IDE declared MainActivity in AndroidManifest.xml (lines 11–21). The notation

Fig. 4.45 AndroidManifest.xml with SettingsActivity declared

Computer code has 33 lines.


in line 12 indicates that the class is in the package specified in line 2 and is shorthand for


We added line 14, which we’ll discuss momentarily.

When you ...

Get Android How to Program, 3/e 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.