We indeed have two classes for SQLite Database access in Android.
- SQLiteOpenHelper
- SQLiteDatabase
Which should we use in our application?
SQLiteDatabase has methods to create, delete, execute SQL commands, and perform other common database management tasks. More specifically SQLiteDatabase provides the insert(), update() and delete() methods.
SQLiteOpenHelper provides utilities to simplify the tasks of creating and initialising the database if it's not already created. In simple, it is a helper class to manage database creation and version management. SQLiteOpenHelper provides the methods getReadableDatabase() and getWriteableDatabase() to get access to an SQLiteDatabase object either in read or write mode.
It is upto the user to decide upon the Class to use within the application.
No comments:
Post a Comment
Thanks for visiting this blog. Please write to me if any doubt. Let me help you if I can.