Android - Shared Preferences are lost sometimes

前端 未结 5 1505
北海茫月
北海茫月 2020-12-08 15:12

Some of the users of my application complain that sometimes (in a random way) the settings of my application are getting reverted to their default state (usually after a reb

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 15:36

    I had a similar problem: my preferences had not been saved reliably. On some devices (in my case the XOOM-Tablet) data got sometimes lost and sometimes not. I've solved the problem by simply calling clear() on the editor before commiting new data.

    Shared Preferences get lost after shutting down device or killing the app

提交回复
热议问题