mardi 17 novembre 2015

CheckBox with onTouch listener

I have a checkbox with onTouch listener and in this listener I have switch with cases: MotionEvent.ACTION_DOWN, MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL.

But I am getting lint warning (onTouch should call View#performClick when a click is detected) if I Don't have view.performClick() in ACTION_UP case. But it makes me method does not work:

public void touchCheckBox(View view) {
    CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox);
    checkBox.performClick();
}

Is view.performClick() necessary in this case or I can suppress the lint warning?




Aucun commentaire:

Enregistrer un commentaire