A few days ago i was experiencing an error which was caused by a call to db.close() inside the onCreate() method.
Some more people had similar problems and this was solved here: Cannot create Android SQLite database: PRAGMA error
I am now really interested in WHY this is happening. I searched some time in the android sources but i couldn’t find the spot where the onCreate() method is called or any documentation about this to find out what happens to the SQLiteDatabase object in the surrounding code of the call to onCreate().
Does anyone knows more about this? Or knows where to read to get to know more about this? 🙂
Finally i found a code snippet which explains what i was experiencing:
this is one code snippet out of the android sources. And you can see from it, that there are many things happen aroung onCreate() and onUpgrade(). So everything is managed by the surrounding code. You (kind of weird talking to myself….) only have to care about doing your DATA related stuff on the db. Creation, Transaction, and closing is handled by the code surrounding it.