package Statement, import Statements and Fields

Figure 8.51 lists class DatabaseConnector’s package statement, import statements and fields. We’ve highlighted the import statements for the new classes and interfaces discussed in Section 8.3. The String constant DATABASE_NAME (line 16) specifies the name of the database that will be created or opened. Database names must be unique within a specific app but need not be unique across apps. A SQLiteDatabase object (line 18) provides read/write access to a SQLite database. The DatabaseOpenHelper (line 19) is a private nested class that extends abstract class SQLiteOpenHelper—such a class is used to manage creating, opening and upgrading databases (perhaps to modify a database’s structure). We discuss ...

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.