vendredi 18 décembre 2015

Android/SQLite deleteDatabase not working as expected

I am working on an Android app, and from time-to-time I need to wipe the SQLite database to start from a clean slate. After some googleing, I found:

context.deleteDatabase(DATABASE_NAME);

However, whenever I execute this statement, then [attempt] re-create my database, my app always starts up empty, with no data. The rest of the UI is there, it's just there is no data. To create the databse, I am using the standard

DatabaseHelper myDBHelper = new DatabaseHelper(this);

which extends SQLiteOpenHelper, that I have seen so many times here on StackOverflow.

As an FYI, when I do not execute the deleteDatabase() statement, all my data loads perfectly, so I know my DatabaseHelper class is working properly.

Aucun commentaire:

Enregistrer un commentaire