I have template database in /assets
directory. This database has to be copied to the main app's database which resides in the private storage area.
Now, all samples I've seen on the Internet seem very odd to me. Namely, they all extend SQLiteOpenHelper
and then create initialization and copy methods, but leave onCreate
and onUpgrade
methods empty.
This does not look like a proper way, and yet I've seen it as an answer in multiple threads on StackOverflow as well on Internet blogs.
Is this really a proper way? Since I thought of doing coping from within onCreate
(within a class that extended SQLiteOpenHelper
) in a way that I first create a database that matches the template database and then I populate it with data from the template database.