Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite0
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}
1 Réponse
+ 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)){}