2013年3月5日星期二

SharedPreferences.getStringSet


public abstract Set<StringgetStringSet (String key, Set<String> defValues)

Added in API level 11
Retrieve a set of String values from the preferences.
Note that you must not modify the set instance returned by this call. The consistency of the stored data is not guaranteed if you do, nor is your ability to modify the instance at all.
--------------------------------------------

Very strange,unbelievable.
We should make a copy of the set to store it like this:
      Set<Str set=new HashSet<String>(setting.getStringSet("key", new HashSet<String>()));

没有评论:

发表评论