Reputation: 3657
I've written up a SqliteHandler class to create, update and handel all queries for the db my app will use. My question is now how to I actually make sure that in the onCreate() method of my MainActivity that I properly call SQLiteHandler and run the code to create/upgrade the db. I've used the @Override
as recommended in the dev guide
Upvotes: 1
Views: 337
Reputation: 9912
According to the documentation of SQLiteOpenHelper:
[...] this class takes care of opening the database if it exists, creating it if it does not, and upgrading it as necessary. Transactions are used to make sure the database is always in a sensible state.
You don't need to worry about creating or updating yourself.
It will be done automatically when using your subclass of SQLiteOpenHelper.
The first time you call getWritableDatabase method, it will check if the database exists and create it if needed.
Upvotes: 1