java.util.ConcurrentModificationException and SharedPreference

前端 未结 2 2128
生来不讨喜
生来不讨喜 2021-02-20 10:31

I\'ve found this crash in crash logs. I don\'t know when it is happening. Can someone give me advice what is the reason? Maybe someone has same crash.

java.util.         


        
相关标签:
2条回答
  • 2021-02-20 11:31

    We had seen this exception when using the SharedPreferences getStringSet method. This method returns a set that should not be modified. Modifying this set while the SharedPreferences object is being serialized to flash will produce a ConcurrentModificationException.

    This will also happen if you use getAll and modify the returned map.

    See the documentation

    0 讨论(0)
  • 2021-02-20 11:34

    Someone have already answered this question, you might be interested to take a look at: ConcurrentModificationException in Android while accessing Shared Preferences

    0 讨论(0)
提交回复
热议问题