public boolean isValid ( boolean questionIsRequired ) { // If required and checked, other types must have text if ( questionIsRequired && isChecked ( ) && isOtherType && ( getOtherText ( ) . length ( ) < 1 ) ) { otherTextInputLayout . setError ( " " ) ; return false ; } otherTextInputLayout . setError ( null ) ; return true ; }
An answer can only be invalid if it s checked the question is required and the type is other but nothing was typed . All answers must be valid to submit in addition to whatever logic the question applies .