The goal seems to be the same: to store key-value pairs. Is there a difference in concept between one and the other?
As far as I can tell, Properties
is a HashTable
that lets you store key-value pairs on memory with the option of persisting them in XML(and other formats). I do not know where this XML would be stored in Android; you probably need to define a location.
SharedPreferences
on the other hand, are guaranteed to be stored on disk space that only your app can access.
From the docs:
The SharedPreferences class provides a general framework that allows you to save and retrieve persistent key-value pairs of primitive data types. You can use SharedPreferences to save any primitive data: booleans, floats, ints, longs, and strings. This data will persist across user sessions (even if your application is killed).
If you need your key-value pairs to be persisted and you don't want to worry about implementations, I would prefer SharedPreferences.
In the case of a properties file you will new to write code to store the modified properties.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With