I have a ListView with Checkboxes, (TextView+Checkboxes) and I did the setOnLongClickListener for the items itself:
view = inflator.inflate(R.layout.rowbuttonlayout, null);
final ViewHolder viewHolder = new ViewHolder();
viewHolder.text = (TextView) view.findViewById(R.id.label);
viewHolder.text.setOnLongClickListener(new OnLongClickListener() {
public boolean onLongClick(View arg0) {
Viewholder comes from my custom adapter to my Listview, no need to specify details I guess. This works pretty good, problem is: if I try to to the same just with setOnItemClickLister (I just want to do a “small” click) I get the error:
The method setOnItemClickListener(new OnItemClickListener(){}) is
undefined for the type TextView
Tried this way:
viewHolder.text.setOnItemClickListener(new OnItemClickListener() {
and
viewHolder.text.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener(){
But I always get that error. What can I do ?
I think you need a plain OnClickListener instead of an OnItemClickListener