O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Create the Database Helper Class

The recommended approach to using SQLite in an Android app is to create a Database Helper class whose only function is to provide for the creation, modification, and deletion of tables in the database. The new class is defined as a subclass of the SQLiteOpenHelper class. Much of the required functionality for working with databases is inherited from the SQLiteOpenHelper class although some of its methods will be overridden to implement the functionality required for this app.

1. Right-click com.example.mycontactlist in the src folder of the Package Explorer.

2. Select New > Class and enter ContactDBHelper as the name of the new class.

3. Type the code in Listing 5.1 into the new class. You will have to import ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required