I\'m writing an android app using SQLite DB.
I had few experiments and changed the DB version from 1 to 2.
Then my DB schema became stable and because i didn
You can override the onDowngrade() by your own if you want to be able to run your application with a database on the device with a higher version than your code can handle.
This is the default implementation of onDowngrade():
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
throw new SQLiteException("Can't downgrade database from version " +
oldVersion + " to " + newVersion);
}
If you need to override this method please read this question also.
Without override that method, we cannot decrease the SQLite version after increased and executed. So you need to change back to 2 or greater than 2:
public DatabaseHelper(Context context) {
super(context, DB_NAME, null, 2);
}
If you are trying to update your table, probably need to pass 3 not 2 and each and every time you need to update the table, you need to increase the version(not decrease).