RecyclerView with Contextual Action Mode to delete an item issue
<p>I have implemented this tutorial <a href="https://www.youtube.com/watch?v=F8eQ_3pmT6Y" rel="nofollow">https://www.youtube.com/watch?v=F8eQ_3pmT6Y</a> in my app to delete recylerview items.
 when I long press on an item, the delete icon will appear on the toolbar and a check box for every row to select an item to delete. But the problem is, when I check first check box Tenth checkbox is also checked check box 2 checks 11th check box and so on. 
does anybody have any idea why its happening. This is my adapter and activity code sorry if it's to long </p>

<pre><code>public class ContentAdapter extends RecyclerView.Adapter&lt;ContentAdapter.contentViewHolder&gt; {
    ArrayList&lt;Heyvon&gt; heyvons = new ArrayList&lt;&gt;();
    MainActivity mainActivity;
    Context context;

    public ContentAdapter(Context context, ArrayList&lt;Heyvon&gt; heyvons) {
        this.context = context;
        this.heyvons = heyvons;
        mainActivity = (MainActivity) context;
    }

    @Override
    public contentViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_view, parent, false);
        contentViewHolder contentViewHolder = new contentViewHolder(view, mainActivity);

        return contentViewHolder;
    }

    @Override
    public void onBindViewHolder(contentViewHolder holder, int position) {
        holder.imageView.setImageResource(heyvons.get(position).getPics());
        holder.name.setText(heyvons.get(position).getName());
        holder.ghaza.setText(heyvons.get(position).getGhaza());
        if (!mainActivity.isInActionMode) {
            holder.checkBox.setVisibility(View.GONE);
        } else {
            holder.checkBox.setVisibility(View.VISIBLE);
        }
    }

    @Override
    public int getItemCount() {
        return heyvons.size();
    }

    public void updateAdapter(ArrayList&lt;Heyvon&gt; list) {
        for (Heyvon heyvon : list) {
            heyvons.remove(heyvon);
        }
        notifyDataSetChanged();
    }

    public static class contentViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
        ImageView imageView;
        TextView name, ghaza;
        CheckBox checkBox;
        MainActivity mainActivity;
        CardView cardView;

        public contentViewHolder(View itemview, MainActivity mainActivity) {
            super(itemview);
            imageView = (ImageView) itemview.findViewById(R.id.imageView);
            name = (TextView) itemview.findViewById(R.id.tv_names_card);
            ghaza = (TextView) itemview.findViewById(R.id.tv_ghaza_card);
            checkBox = (CheckBox) itemview.findViewById(R.id.checkBox);
            this.mainActivity = mainActivity;
            cardView = (CardView) itemview.findViewById(R.id.cardview);
            cardView.setOnLongClickListener(mainActivity);
            checkBox.setOnClickListener(this);
        }

        @Override
        public void onClick(View view) {
            mainActivity.prepareSelection(view, getAdapterPosition());
        }
    }
}
</code></pre>

<p>Code in Activity</p>

<pre><code>@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_activity_main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.item_delete) {
        isInActionMode = false;
        ContentAdapter contentAdapter = (ContentAdapter) adapter;
        contentAdapter.updateAdapter(selectedlist);
        ClearActionMode();
    } else if (item.getItemId() == android.R.id.home) {
        ClearActionMode();
        adapter.notifyDataSetChanged();
    }
    return true;
}

public void ClearActionMode() {
    isInActionMode = false;
    toolbar.getMenu().clear();
    toolbar.inflateMenu(R.menu.menu_activity_main);
    getSupportActionBar().setDisplayHomeAsUpEnabled(false);
    counter_text_veiw.setVisibility(View.GONE);
    counter_text_veiw.setText("0 item is selected");
    counter = 0;
    selectedlist.clear();
}

@Override
public boolean onLongClick(View view) {
    toolbar.getMenu().clear();
    toolbar.inflateMenu(R.menu.menu_action_mod);
    counter_text_veiw.setVisibility(View.VISIBLE);
    isInActionMode = true;
    adapter.notifyDataSetChanged();
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    return false;
}

public void prepareSelection(View view, int position) {
    if (((CheckBox) view).isChecked()) {
        selectedlist.add(heyvons.get(position));
        counter = counter + 1;
        updateCounter(counter);
    } else {
        selectedlist.remove(heyvons.get(position));
        counter = counter - 1;
        updateCounter(counter);
    }
}

public void updateCounter(int counter) {
    if (counter == 0) {
        counter_text_veiw.setText("0 item is selected");
    } else {
        counter_text_veiw.setText(counter + " item is selected");
    }
}

@Override
public void onBackPressed() {
    if (isInActionMode) {
        ClearActionMode();
        adapter.notifyDataSetChanged();
    } else {
        super.onBackPressed();
    }
}
</code></pre>