Reputation: 3578
I have Database in my application which is created by just coping the SQLite database file from the assets folder but now in the next release I want to update the database without losing the previous data.
Is there any Logic or way to copy the previous data and create a new database through SQLiteOpenHelper so that in near future I will not face this problem.
Thanks
Upvotes: 0
Views: 329
Reputation: 2730
OnUpgrade
method, copy your previous data from the old database.doUpgrade
method, use your copied data to update the new database.Upvotes: 1
Reputation: 2256
Previous data will be kept by default when users update to a new version. but you must keep in mind there will be new users never get a former version app. So you should add complete database in the assets folder.
Upvotes: 0