It seems like SQLite (1-st impression) stores it`s data temporary, while executing SQLiteOpenHelper and creating tables there, and inserting rows within onCreate method.
The Q is: Is there an ability to store data permanently and do not create DB and Tables every time the app is start-up? As I understand the data kills, when user exit the app?
Sorry for my English and a lame question – I’m new to Android =)
Thanks in advance.
It seems like SQLite (1-st impression) stores it`s data temporary, while executing SQLiteOpenHelper and
Share
Your initial impression is incorrect. SQLite tables are persistent in Android – they exist as files in a particular directory based on your application’s package id.
The idea of the SQLiteOpenHelper is to encapsulate database creation AND database upgrade in one place, so that the rest of your database-using code doesn’t have to worry about such things – it just called the helper and when the helper returns, the database is exactly as it should be.
That’s why the helper has an ‘onCreate’ method (which is used when the database doesn’t already exist) and an ‘onUpdate’ method (which is used when the database already exists, but has a different version number).