gpt4 book ai didi

Android:在更新值之前删除 SharedPreference?

转载 作者:行者123 更新时间:2023-11-30 01:59:24 28 4
gpt4 key购买 nike

你是否应该在更新它的值之前删除旧的 SharedPreference...像这样:

Editor.remove("KEY1");//remove old value
Editor.putString("KEY1", newValue);//same key, new value
Editor.apply();

或者是

Editor.putString("KEY1", newValue);//just add new value
Editor.apply();

只是覆盖旧数据而不产生任何后果?

最佳答案

不,旧值将被覆盖。

关于Android:在更新值之前删除 SharedPreference?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31726149/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com