sharedpreferences stringset value how to remove in android studio.? : i want to be able to do this to the code,I am new to programing please help.i have uncheck the checkbox(per item) to remove it .i am using to sharedpreferences with HashSet concept one page to another page pass to arraylist value,what i do what is my mistake some one help me.

my code is:

    adapterpage.java
    
    public static final String MY_PREFS_NAME = "";
    
    
    @Override
        public void onClick(View view) {
    
                boolean isChecked = mainHolder.chekenitem.isChecked();
    
                // arr=getResources().getStringArray(  mainHolder.txtenimgid.getText().toString());
                //  boolean isChecked = mainHolder.chekenitem.isChecked();
                int i;
                String itemId1 = mainHolder.txtenimgid.getText().toString();
            SharedPreferences prefs=view.getContext().getSharedPreferences(MY_PREFS_NAME,Context.MODE_PRIVATE);
            SharedPreferences.Editor edit=prefs.edit();
            Set<String> set = new HashSet<String>();
            try {
                if (isChecked) {
    
    
                    addmembers.add(itemId1);
    
                    for (j = 0; j < addmembers.size(); j++) {
                        set.addAll(addmembers);
                       edit.putStringSet("yourKey", set);
                       edit.commit();
                       Toast.makeText(view.getContext(), "Clicked on Checkbox addmembers[pos] : " + addmembers.get(j) + " Item Id is " + itemId1
                               , Toast.LENGTH_LONG).show();
    
                   }
    
                        //   editor.putString("key_name",itemId );
                        // editor.apply();
    
                  //  }
    
                } else {
                    for(int k=0;k<=addmembers.size();k++){
                        if(addmembers.get(k).equals(itemId1)){
                          //  set.remove(addmembers);
                            addmembers.remove(k);
                            edit.remove(addmembers.get(k));
                            edit.commit();
    
                            break;
                        }
    
    
                    }