Tutorial :Android Local Storage files getting erased on reboot


I have an android app that stores data to the local storage. This is done just like in the tutorial on Google's site:

String FILENAME = "data.xml";  String string = "some content";    FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);  fos.write(string.getBytes());  fos.close();  

However, whenever the device is powered off, then powered back on, these files are removed. How can I get them to stay?


i've never seen implementing localStorage like this. i try and do it the way it's introduced here:

http: // www. webreference.com/authoring/languages/html/HTML5-Client-Side/

BUT, the same problem for me, because whenever i restart my iPhone, the localStorage is cleared... maybe the client-side database, which also is described on the above link, will help us there :)

edit: (some minutes later)

just restarted my iPhone and tested my application again - otherwise it won't let me fall asleep tonight:) - it works this is a quite good article about local storage and at the end a very very VERY nice example, that works too. Problem maybe: language of article is german, but example tells it own tale ;)

article: http://blog.robocode.ch/685/html-5-local-data-storage-eine-kurze-einfuhrung/ example from article: http: // www. robocode.ch/lab/localstorage/

explanation for non-german speakers: "Bleibt für ewig" - entries will be there forever "Bleibt bis das Browserfenster verlassen oder der Browser geschlossen wird. (Je nach Browser)" - entries will be deleted as soon as session is over, browser closed, browser window closed (depending on browser)

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »