I am using shared preferences to store different languages a user enters and display them in a recyclerView . when the users clicks the remove button , i want to remove the selected value from the shared pref
I have written the following code but i don't know where i went wrong
pref = contexts.getSharedPreferences("user", 0);
gson = new Gson();
json = pref.getString("language" , "");
Type type = new TypeToken<List<String>>() {}.getType();
List<String> DataPackage = gson.fromJson(json, type);
String item = DataPackage.get(getAdapterPosition());
String items = pref.getString("language" , item);
editor = pref.edit();
editor.remove(items);
editor.commit();
I want the single item from the pref to be removed but nothing happens , it dosn't remove the data