I need to set an error for a password field with the condition "Only 2~22 characters and symbols , _ - are allowed."
But I am a little stuck here.
Here is what I got so far:
if(
!(editText.length() >= 2 && editText.length() <= 22 ) ||
!(editText.contains("-") || editText.contains("_") || editText.contains(","))
) {
//set error message
}
But the problem is that if I input a symbol other than , _ or -, the error message still doesn't show. For the input length, the error message shows as it should though.