java.util.ConcurrentModificationException and SharedPreference

前端 未结 2 2169
生来不讨喜
生来不讨喜 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

提交回复
热议问题