Here is my code that I got share preference
 private void getAllSharePreference() {
     SharedPreferences sharedPreferences = getContext().getSharedPreferences(SharePreferenceKey.SONG_LIST, Context.MODE_PRIVATE);
     getSongJson = sharedPreferences.getString(SharePreferenceKey.SONG_LIST, "N/A");
     if (!getSongJson.equals("N/A")) {
         Type type = new TypeToken<List<SongRespones.Songs>>() {}.getType();
         songSharePreference = new Gson().fromJson(getSongJson, type);
         adapter.addMoreItem(songSharePreference);
         rvFavorite.setAdapter(adapter);
    }
}
This is my code that I want to clear list in share preference by position recyclerview.
@Override
public void onClickView(final int position, View view) {
    final PopupMenu popupMenu = new PopupMenu(getContext(), view);
    popupMenu.inflate(R.menu.remove_favorite);
    popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
                case R.id.popup_remove_favorite:
                    songSharePreference.remove(position);
                    adapter.notifyItemChanged(position);
                    break;
            }
            return false;
        }
    });
    popupMenu.show();
}
But I cannot clear share preference. Please help me:
 
     
    