[英]resetting a shared preference value to null in android
If I was to set a key/value pair in android preferences what would be the best way to go back and unset the value to null while maintaining the key? 如果我要在android偏好中设置一个键/值对,那么在保持键的同时返回并将值取消为null的最佳方法是什么? what I would like to do is set and unset the value programmatically, thanks in advance. 我想要做的是以编程方式设置和取消设置值,提前感谢。
Its as simple as: 它很简单:
yourEditor.remove("your key to remove");
and you must remember to commit as usual: 你必须记得照常提交:
yourEditor.commit();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.