I want to change respective image of clicked item in recycler view. Now whats happening is if i click on item 2 image is changing at random item position in the list
<
Try this:
@Override
public void onBindViewHolder(MyRecyclerViewAdapter.DataObjectHolder holder,int position {
holder.name.setText(mDataset.get(position).getName());
holder.regId.setText(mDataset.get(position).getRegId());
holder.roomNo.setText(mDataset.get(position).getRoomNo());
holder.testImage = (ImageView)itemView.findViewById(R.id.log)
holder.testImage.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
name.setImageResource(Anything you want);
}