So far I have made a text file in my assets folder and I can read it fine and does what it is supposed to do. When I write to it using the following:
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(("0").getBytes());
fos.close()
it works. However when I close my app and reopen it later, it does not remember anything I changed it to.
Any ideas?
Files in assets or raw are intended to be read-only, so copy it to a new location (like in
Environment.getDataDirectory()) and then you should be able to write to it.I would think this would throw some type of exception do you have an empty catch block? At a minimum you should use
e.printStackTrack()otherwise your app will silently fail…