views:

85

answers:

1

Hi all,

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 gives a sqlite file).

When user clicks on the button i need to upgrade the old db file with new db file from URL.

Please suggest me how i can do this, or give me a reference to follow

Thank you

+3  A: 

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.)

beekeeper