My application uses a sqlite DB, which is pre-created and copied on runtime from the assets folder. It usually works just fine. I have recenetly added a new column to the DB, and incremented the DB version in order for the onUpgrade method to run. this all works well, but the new DB is copied without the newly added column. This is the onUpgrade code:
//Open your local db as the input stream
InputStream myInput = myContext.getAssets().open(DB_NAME);
// Path to the just created empty db
String outFileName = DB_PATH + DB_NAME;
//Open the empty db as the output stream
OutputStream myOutput = new FileOutputStream(outFileName);
//transfer bytes from the inputfile to the outputfile
byte[] buffer = new byte[1024];
int length;
while ((length = myInput.read(buffer))>0){
myOutput.write(buffer, 0, length);
}
//Close the streams
myOutput.flush();
myOutput.close();
myInput.close();
Any ideas how to solve it?
10X!