Search in sources :

Example 1 with PositiveNumber

use of org.eyeseetea.malariacare.domain.entity.PositiveNumber in project pictureapp by EyeSeeTea.

the class PositiveNumberSingleQuestionView method validateAnswer.

private void validateAnswer(Context context) {
    try {
        PositiveNumber positiveNumber = PositiveNumber.parse(numberPicker.getText().toString());
        hideKeyboard(numberPicker);
        notifyAnswerChanged(String.valueOf(positiveNumber.getValue()));
        Validation.getInstance().removeInputError(numberPicker);
    } catch (InvalidPositiveNumberException e) {
        Validation.getInstance().addinvalidInput(numberPicker, context.getString(R.string.dynamic_error_age));
        numberPicker.setError(context.getString(R.string.dynamic_error_age));
    }
}
Also used : PositiveNumber(org.eyeseetea.malariacare.domain.entity.PositiveNumber) InvalidPositiveNumberException(org.eyeseetea.malariacare.domain.exception.InvalidPositiveNumberException)

Aggregations

PositiveNumber (org.eyeseetea.malariacare.domain.entity.PositiveNumber)1 InvalidPositiveNumberException (org.eyeseetea.malariacare.domain.exception.InvalidPositiveNumberException)1