SharedPreferences & boolean

后端 未结 3 1879
不知归路
不知归路 2021-01-07 11:26

I\'m trying to set the \"isPhysicalTheftEnabled\" to false when a method is executed, but this doesn\'t seem to work. Anyone have any idea?

        SharedPre         


        
3条回答
  •  终归单人心
    2021-01-07 11:54

    You need to call ed.apply() after changing values in SharedPreferences.

    You can also use ed.commit() if you want to check for errors. commit() (unlike apply()) returns false if the data was not (correctly) written to the persistent storage.

提交回复
热议问题