Monday, February 13, 2012

How to validate all EditText in Android Layout?


private boolean validate() {
final int childrenCount = root.getChildCount();
for (int i = 0; i < childrenCount; i++) {
View child = root.getChildAt(i);
if (child instanceof EditText) {
if (TextUtils.isEmpty(((EditText) child).getText().toString()))
return false;
}
}
return true;
}

No comments:

Post a Comment