I want to create an offline dictionary application, which is sometimes required for updating, and the old database will be replaced with a new one. This is what I want to do, and I did something like this with the SQLiteAssetHelperLibrary:
Note. will copy the database from the data folder to the application data folder SQLiteAssetHelper
public class MyDb extends SQLiteAssetHelper {
private static final String DATABASE_NAME = "db.sqlite";
private static final int DATABASE_VERSION = 1;
public MyDb(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
}
Now I want to update the database by adding a new db.sqlitefile to the folder assets, I manipulate my codes as follows:
public class MyDb extends SQLiteAssetHelper {
private static final String DATABASE_NAME = "db.sqlite";
private static final int DATABASE_VERSION = 2;
public MyDb(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
}
but when I compiled and started, it says: It is not possible to update a read-only database from version 1 to 2
what's the solution?
clearing the application data, it will work fine ...
AVOID FOR MY BAD ENGLISH ...