I have some EditText which is of "numberDecimal", and One Button. When user clicks on button, data goes to Database. So how to check EditText is empty or not. I am getting error when I try to parse the EditText.
Asked
Active
Viewed 311 times
-4
-
**`TextUtils.isEmpty(editText.getText().toString().trim());`** – AskNilesh Apr 05 '18 at 07:08
1 Answers
0
To check an edittext is empty:
EditText ed = (EditText) findViewById(R.id.ed);
age = ed.getText().toString();
if (age.matches("")) {
Toast.makeText(this, "Empty", Toast.LENGTH_SHORT).show();
return;
}
You can also use equals() instead of matches()

kgandroid
- 5,507
- 5
- 39
- 69
-
Thx, But I have Float Value. Complainer does not able to pars 0 value – korat krupal Apr 05 '18 at 07:09
-