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 SQLiteOpenHelper
in more detail in Fig. 8.58.