У меня есть база данных, созданная из файла в моей папке с оценками. Когда приложение будет обновлено, я хочу, чтобы новый файл в этой папке добавлялся (добавлялся) в текущую базу данных. В настоящее время я пытаюсь использовать этот скрипт ниже, но он не работает. Я просто не добавляю в БД.
//Open your local db as the input stream
InputStream myInput = myContext.getAssets().open(STATIC_DB_NAME);
// Path to the just created empty db
String outFileName = STATIC_DB_PATH + STATIC_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();