I have a custom method to
copy the database from assets folder to the database directory
AssetManager am = myContext.getAssets();
OutputStream os = new FileOutputStream(DBFile);
DBFile.createNewFile();
byte []b = new byte[1024];
int i, r;
String []Files = am.list("");
Arrays.sort(Files);
for(i=1;i<5;i++) {
String fn = String.format("0%d.database", i);
if(Arrays.binarySearch(Files, fn) < 0)
break;
InputStream is = am.open(fn);
while((r = is.read(b)) != -1)
os.write(b, 0, r);
is.close();
}
os.close();
All works as expected and the database is copied to the apps database directory except for when I change the android system language (settings>language) and set the system language as arabic, and re install the app, it crashes and the database file isn't copied to the databases directory. It's just a blank file.
Im thinking maybe i should read the database file with an encoding specified because something must change in java dhe moment I change the language.