The package and import Statements

Figure 3.9 shows the package statement and import statements in MainActivity.java. The package statement in line 3 was inserted when you created the project. When you open a Java file in the IDE, the import statements are collapsed—one is displayed with a Image to its left. You can click the Image to see the complete list of import statements.

Lines 5–14 import the classes and interfaces the app uses:

• Class NumberFormat of package java.text (line 5) provides numeric formatting capabilities, such as locale-specific currency ...

Get Android™ How to Program, Second 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.