Take the 2-minute tour ×

In an android application, what is the best method to store primitive data variables (such as a list of 3 integers) on the device so that those integers can be seen and manipulated by the app, but remain on the device after updating the app?

also, it would be best if there was a way to tell the difference between the user updating and uninstalling and delete the file upon the latter. Any easy way to do this that i'm unaware of?

Any example code of the actual serializing of a piece of data would be very helpful.

I'm reading the documentation, but having trouble finding really clear examples.

share|improve this question
Are you aware of the SharedPreferences? –  user658042 Nov 25 '11 at 21:38
I've been looking at that, but it doesn't specify in the documentation how persistent the data is. Will Shared Preferences persist after updating the app? Internal Storage specifically says that files are deleted at uninstall. I guess my question is more about that. –  cody Nov 25 '11 at 22:03
Yes, the SharedPreferences will persist with every app update, as already answered here. In the early days there used be an issue in combination with forward lock/copy protection, but that was fixed in 1.5. –  MH. Nov 25 '11 at 22:17
add comment

1 Answer

up vote 0 down vote accepted

Refer here!

share|improve this answer
I won't downvote this since you are new to StackOverflow, but: Answers that contain only a link are bad. Please give at least a small summary what the answer in the link is and add it for further information. Also please label links with something else than "here", so that interested people have an idea where they go when they click the link. Thanks. –  user658042 Nov 26 '11 at 13:29
And also add that this is your very own blog when you link to it for reasons of transparency. –  user658042 Nov 26 '11 at 13:32
Ok , thanks you your guidance –  Tapan Thaker Nov 27 '11 at 16:50
Also , I will be editing the post when i get time –  Tapan Thaker Nov 27 '11 at 16:57
add comment

Your Answer


