0

Ways of checking text in the filling form

Hi! Please tell me, which option to check the presence of text in the filling view is more preferable: String s = editText.getText().toString(); // 1 option If(s.equalsIgnoreCase("")) { // some code} // 2 option If(s.matches("")) { // some code}

30th May 2019, 1:04 PM
Yuri Kurashov
Yuri Kurashov - avatar
1 Answer
+ 15
Best way to check edittext was filled or not is using TextUtils class. In that class use static method isEmpty() Example String a = editText.getText().toString(); if(!TextUtils.isEmpty(a)){}
31st May 2019, 12:06 PM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar