Skip to content Skip to sidebar Skip to footer

How To Upgrade Sqlite Database File

Im doing an app which uses sqlite db file in assets folder, There is a screen in my app having a button 'check for update'. Client has given me an URL link to update db file(which

Solution 1:

The assets folder is read-only, so you won't be able to change or replace that copy.

Basically, you need to copy your DB file out of the assets folder into a writable application directory (probably from getFilesDir() or getExternalFilesDir()). You'll open this copy when you are actually operating, and you'll replace it with the new DB from the web when your user hits the UPDATE button. Because a SQLite database is just a file, there's no problem with deleting the old one and replacing it with a new one. (Close the old one before deleting, of course, for cleanliness.)

Post a Comment for "How To Upgrade Sqlite Database File"