I want to know which is better for storage purpose: Shared preferences or internal file storage. Which is faster? Is there any memory issue with anyone of them?
Thanks,
I want to know which is better for storage purpose: Shared preferences or internal file storage. Which is faster? Is there any memory issue with anyone of them?
Thanks,
More about Storage Options here: Storage Options
I have seen an issue about shared preference.
Issue: Whenever you face Force close/app crash while using SharedPreference, SharedPreference will be null. Here you can read more about it: Shared Preferences reset when the app is force closed or crashes
Well, the Shared preferences
also saved in the internal file storage
at last.
the Share preferences
like the key-value
pair, it keep the data in memory, and saved to the internal file storage by system at last.
if you want to access the value frequently, you can use
Shared preferences
.if you data structure is small and not complicated, you can directed use
Share preferences
if you just want to save data, and the data is will taken many memory space, you can just use file to save.
Please read Android document related to data storage.
If you want to store very small values then you can opt for SharedPrefrence.
It totally depends on what you like to do: If you have a rather small amount of key-value pairs go with the Shared Preferences. If you have a larger amount of data use a file as the Shared Preferences will be hold in memory after they where first used. So it's a bad idea to store large amount of data in it ;-).