I wanna know whether is it possible to store array of string in the SharedPreferences. In my application i want , set of names to be stored. I know this can be done using DB,i just wanna know whether is it possible to save those set of name as array of strings in the SharedPreferences.
You can store set of String using SharedPreferences
in API Level 11 and higher. See getStringSet()
and putStringSet()
ю
In API Level prior to 11 you can use some kind of hack. For example, if you need to store string array under key "stringArray", you can save each string from array using putString
and keys "stringArray.1", "stringArray.2", so on.
If you are looking for StringTokenizer then blog post 1 and blog post2 would be helpful
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