Search code examples
androidandroid-sqliteactiveandroid

Clear Shared Preference after Active Android onUpgrade


How to detect if the database version has changed and perform actions in ActiveAndroid. Similar to onUpgrade in SQLiteDatabaseHelper?


Solution

  • The DatabaseHelper of ActiveAndroid doesn't seem to support what you're looking for. But it's on GitHub, so you can modify the library to your needs.

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        executePragmas(db);
        executeCreate(db);
        executeMigrations(db, oldVersion, newVersion);
    }