I\'m building an application for receiving grades and I want to make sure that the Edit Texts are not empty and the values are less or equal to 100 I wrote this line but it
If you want to control what digit should enter use android:digits=""
android:inputType="number"
enforce to open number type keyboard still user can press other char like "#,." than may cause NumberFormatException
android:digits="0123456789" only accepts 0123456789 in EditText
, not any other char
Before converting any string integer you must check if it is empty
String strNumber=editText.getText().toString().trim();
if(TextUtils.isEmpty(strNumber) || Integer.parseInt(strNumber)>100){
// show your error message
}