In my android Kotlin app, i use a sharedPreferences to stored a list of product chosen.
The following code is to stored data in ArrayList with Key "Products"
After that, i choose one product of this list to delete it, which i have the productid.
I want to know howa can i remove this product from the sharedPreferences with key "Products"
the following code is my attempt :
I don't follow that code, but I think the obvious approach would be: retrieve the list from the prefs, add or remove items from it however appropriate, and then save it back to the prefs. That way, editing the list is independent from handling the preferences - which I think it should be.