I have 4 EditTexts
in my activity. Each one has an OnClickListener
that when called will check a checkbox for me. However, when I first press on the EditText
, the EditText
turns blue, but the checkbox does not check. It is only when I press on it again that the OnClickListener
takes effect and checks the box.
Does anyone know why this is?
Example code:
public View.OnClickListener respiratoryOnClickListenerv(final View v) {
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View view) {
CheckBox respiratoryCheckbox = (CheckBox) v.findViewById(R.id.vitals_2);
respiratoryCheckbox.setChecked(true);
respiratoryCheckbox.callOnClick();
}
};
return listener;
}
respiratoryEditText.setOnClickListener(respiratoryOnClickListenerv(rootView));