diff --git a/CheckboxQuestion/CheckboxQuestion/src/main/java/com/aadyad/checkboxquestion/Views/YesOrNoQuestion.java b/CheckboxQuestion/CheckboxQuestion/src/main/java/com/aadyad/checkboxquestion/Views/YesOrNoQuestion.java index acb4ba7..02f66f4 100644 --- a/CheckboxQuestion/CheckboxQuestion/src/main/java/com/aadyad/checkboxquestion/Views/YesOrNoQuestion.java +++ b/CheckboxQuestion/CheckboxQuestion/src/main/java/com/aadyad/checkboxquestion/Views/YesOrNoQuestion.java @@ -121,7 +121,9 @@ public void onClick(View v) { no.setChecked(false); yes.setChecked(true); buttonClicked = 1; - onAnswerChangedListener.onAnswerChanged(buttonClicked, yes.getText().toString()); + if (onAnswerChangedListener != null) { + onAnswerChangedListener.onAnswerChanged(buttonClicked, yes.getText().toString()); + } } }); @@ -131,7 +133,9 @@ public void onClick(View v) { no.setChecked(true); yes.setChecked(false); buttonClicked = 2; - onAnswerChangedListener.onAnswerChanged(buttonClicked, no.getText().toString()); + if (onAnswerChangedListener != null) { + onAnswerChangedListener.onAnswerChanged(buttonClicked, no.getText().toString()); + } } }); }