I use a ContentProvider in my app and everything works great except for one little issue. I have a backup and restore function that backs up the database to a file on the SD card and then those backup files can be restored to overwrite the current database. This whole process is working, but the ContentProvider still holds the reference/cache to the original database once one of the old backup files is restored. I can't seem to find a way to refresh or reload the database reference in the ContentProvider. I know the restore works because I can see the records in the db with SQLite Editor and when I close and re-open the app, it displays the correct records.
Does anybody know a way to do this? Is there a way to close and re-open the ContentProvider that I'm not seeing?
db = new DbAdapter(getContext());
. This is what all of the examples show. I thought about doing it in each method, but that seems very inefficient to me and sort of slow. Don't you think? Well, I guess I'll try it that way and see how it works. Isn't that going to leave a bunch of open db objects as well if I have multiple queries/updates or will the ContentProvider manage them properly? – Physoclistous