Note that there are some explanatory texts on larger screens.

plurals
  1. POAfter restoring sqlite database, old file stays active??
    text
    copied!<p>I have a restore option in my app, which reads in the back-up file, and copies it over the original sqlite-db.</p> <p>Everything seems to work fine, except for the fact that after the restore, the old db-file is still active. If I shut down my application completely, using <code>System.exit(0);</code>, it does load the restored database, and everything works as expected.</p> <p>It seems that the application keeps the old db-file in RAM, although that seems odd ...</p> <p>Below the code:</p> <pre><code> File dbFile = new File(DatabaseHelper.DB_PATH + DatabaseHelper.DB_NAME); if (dbFile.exists()) { Boolean fileDeleted = dbFile.delete(); Log.i(DatabaseHelper.LOG_TAG, "fileDeleted: " + String.valueOf(fileDeleted)); } try { Log.i(DatabaseHelper.LOG_TAG, "myDatabase.isOpen: " + String.valueOf(dbHelper.myDataBase.isOpen())); dbHelper.cleanup(); Log.i(DatabaseHelper.LOG_TAG, "myDatabase.isOpen: " + String.valueOf(dbHelper.myDataBase.isOpen())); Boolean newFileCreated = dbFile.createNewFile(); Log.i(DatabaseHelper.LOG_TAG, "newFileCreated: " + String.valueOf(newFileCreated)); FileUtil.copyFile(dbBackupFile, dbFile); return null; } catch (IOException e) { Log.e(DatabaseHelper.LOG_TAG, e.getMessage(), e); return e.getMessage(); } </code></pre> <p>Somebody experienced the same?</p> <p>I did check to see if some activity has the db open, but as far as I can see, this is nowhere the case. All the log-entries show expected/correct values ...</p> <p>I've tried everything, so any suggestions/ideas are very much appreciated!!</p> <p>Thanks in advance.</p> <p>Greetingz, Koen Hoorelbeke&lt;</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload