我已经在我的应用程序中创建了数据库并将数据存储在该数据库中,当我在模拟器中运行我的应用程序时,它会显示所有数据,但是当我在我的 android 设备中运行相同的应用程序时,它会显示错误?这是我的代码。
private static String DB_NAME = "pa1.db";
private static String DB_PATH = "/data/data/in.bitcode.sn/databases/";
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();