I am creating an Android Application and I am using sqlite database in it. for that I have placed a sqlite file in assets folder of project and I am copying this file to pho
I have found solution for this, I have used below function :
public void createDb() {
boolean dbExist = checkDataBase();
if (dbExist) {
// do nothing - database already exist
} else {
// call close() for properly copy database file
this.getReadableDatabase().close();
try {
copyDataBase();
} catch (IOException e) {
e.printStackTrace();
throw new Error("Error copying database");
}
}
}
As per this post we need to call close() and you can push database to Oneplus two devices also.