我在StackOverflow上提出了另一个不同的问题,但是我的问题有点新.
我将设备更新为Android KitKat 4.4,并尝试使用以下代码复制数据库时:
private void copyDataBase() throws IOException {
InputStream myInput = context.getAssets().open(DB_NAME);
String outFileName = DB_PATH + DB_NAME;
OutputStream myOutput = new FileOutputStream(outFileName);
byte[] buffer = new byte[1024];
int length;
while ((length = myInput.read(buffer)) > 0) {
myOutput.write(buffer, 0, length);
}
myOutput.flush();
myOutput.close();
myInput.close();
}
我在以下行获得FileNotFoundException:
OutputStream myOutput = new FileOutputStream(outFileName);
有人在Android KitKat上解决了这个问题吗??? (其他平台效果很好)
感谢帮助.
朱利奥