简体   繁体   中英

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? 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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM