In your xml where you have declared edittext make sure that you put the following attribute in edittext element
android:inputType="number"
And change above code to this :
if(editText.getText().toString().trim().isEmpty() || Integer.parseInt(editText.gettext().toString()) > 100 )
{
//Error message for example
}
you first need to check if text is not empty
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…