34,333
edits
Changes
→Implementing the Data Handler
== Implementing the Data Handler ==
The data handler will be implemented by subclassing from the Android SQLiteOpenHelper class and, as outlined in An Overview of Android SQLite Databases, adding the constructor, onCreate() and onUpgrade() methods. Since the handler will be required to add, query and delete data on behalf of the activity component, corresponding methods will also be need to be added to the class.
Begin by adding a second new class to the project. This time the class will be named MyDBHandler and subclassed from android.database.sqlite.SQLiteOpenHelper. Once the new class has been created, load it into an editing panel where it will read as follows: