Skip to content

clicking an item affects another item #16

@HussamShams

Description

@HussamShams

Hi,

There's nothing wrong with the grid but when I click an item - say section 0, item 10 - the onClick action is triggered on section 0, item 0! I log the section and position and they're always correct. here's the onBindItemViewHolder method:

`public void onBindItemViewHolder(ItemViewHolder viewHolder, final int section, final int position) {
final SubjectViewHolder holder = (SubjectViewHolder) viewHolder;
Subject subject = subjects.get(section).get(position);

    holder.tvName.setText(subject.getNameEn());


    Glide.with(context)
            .load(subject.isSelected() ? R.drawable.ic_star_selected : R.drawable.ic_star)
            .into(holder.ivSelection);


    holder.tvName.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.e("CLICK", "SEC: " + section + " POS: " + position);
            Flubber.with()
            .animation(Flubber.AnimationPreset.POP)
            .duration(600)
            .createFor(holder.tvName)
            .start();
        }
    });`

How can I fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions