January 2014
Intermediate to advanced
736 pages
70h 43m
English
DatabaseConnection’s constructor (Fig. 8.52, lines 22–27) creates a new object of class DatabaseOpenHelper (Fig. 8.58), which will be used to open or create the database. We discuss the details of the DatabaseOpenHelper constructor in Fig. 8.58. The open method (lines 30–34) attempts to establish a connection to the database and throws a SQLException if the connection attempt fails. Method getWritableDatabase (line 33), which is inherited from SQLiteOpenHelper, returns a SQLiteDatabase object. If the database has not yet been created, this method will create it; otherwise, the method will open it. Once the database is opened successfully, it will be cached by the operating system to improve ...
Read now
Unlock full access