I have a viewholder
in my Android app and I tried to set an incremented value on a textfield. I tried it like following,
Activity
You also need to set a tag
for the Button, if you want to manipulate the holder item.
if (convertView == null) {
...
holder.buttonPlus = (ButtonRectangle) convertView.findViewById(R.id.buttonPlus);
holder.buttonPlus.setTag(holder);
holder.buttonPlus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Holder current= (Holder) v.getTag();
current.inc=current.inc+1;
notifyDataSetChanged();
}
});
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}