Check entered value is number or not
If boolean value is true then it is number otherwise string value
boolean digitsOnly = TextUtils.isDigitsOnly(editText.getText());
or for Example
String text = edt_email.getText().toString(); boolean digitsOnly = TextUtils.isDigitsOnly(text); if (digitsOnly) { if (text.length() == 0) { Toast.makeText(getApplicationContext(), "field can't be empty.", Toast.LENGTH_LONG).show(); } else { Toast.makeText(getApplicationContext(), "field is int value", Toast.LENGTH_LONG).show(); } }else { Toast.makeText(getApplicationContext(), "Field is string value", Toast.LENGTH_LONG).show(); } }