So I have a list view with custom adapter that has text view and a checkbox. The problem is, I'm trying to get it so that the checkbox would get checked when I click (in this case long click) a list item. I've tried many different ways of getting this to work with no luck.
Here's my latest and for some reason this returns a null pointer:
convertView.setTag(R.id.listCheckBox, viewHolder.checkOrder);
convertView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
CheckBox cb = (CheckBox) v.getTag();
cb.setChecked(true);
return false;
}
});
Bare in mind that I'm a beginner in android dev.
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire