I would like to store a Location object and am trying to pick a good way to do it. I just have the one small object, and I need it to be private, so SharedPreferences or Internal Storage make the most sense to me so far.
I see that an object can be written to a bytearray, stored as a String in SharedPreferences, then written back to an object as described here.
Is that a reasonable approach? Is there a better way?
Thanks for any advice.
When saving simple data I prefer using JSON objects as the code is simpler and easier to understand for future maintainers than manipulating byte arrays. Since the objects are small the size penalty for using strings instead of byte arrays is not significant.