I create a database on the first run of my app and seed it as well. Sometimes I need to update the database from an outside source so I have to place it in on the Android's Documents Folder and get it from there. So, I copy that database from Documents folder into the applications database using the code below. Using the debugger, I can finish the whole application without any errors and also on the logs. However, as soon as I check the databse in the application itself in the "data/data/com.myApp.com/databases/dbName.db" This database does not get updated or the database in the Documents folder is not copied. I also tried placing the db to be copied in the application's "assets" folder but I still don't get the desired reult:
main_activity
DatabaseHelper db = new DatabaseHelper(getActivity().getApplicationContext());
db.copyDatabase();
DatabaseHelper
public void copyDatabase() {
DB_FILE = context.getDatabasePath(DB_NAME);
try {
InputStream mInput = mContext.getAssets().open(DB_NAME);
OutputStream mOutput = new FileOutputStream(DB_FILE);
byte[] mBuffer = new byte[1024];
int mLenth;
while((mLenth = mInput.read(mBuffer)) > 0) {
mOutput.write(mBuffer, 0, mLenth);
}
mOutput.flush();
mOutput.close();
mInput.close();
} catch (IOException e) {
e.printStackTrace();
}
}