I have a big text file containing SQL CREATE TABLE
and INSERT
statements. How do I import this file in the SQLiteOpenHelper
onCreate
method?
Or, is there an accepted way of using the binary database file directly?
I need this to be compatible with Android 1.6.
I had to solve the same problem. Couldn't find a direct way to do it, so I put the file into the res/raw directory and used openRawResource
to get an InputStream on it. I then read lines until one ended with a ;
. I then passed the statement to the sqlite database.
Hopefully someone else comes along with a better way, but I thought I would just add the way that I ended up doing it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With