Back to project page ExpertAndroid.
The source code is released under:
MIT License
If you think the Android project ExpertAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.iuriio.demos.expertandroid.ch6forms; /* w ww. java 2s. c o m*/ import java.util.ArrayList; public abstract class FormActivity extends BaseActivity { private ArrayList<IValidator> ruleSet = new ArrayList<IValidator>(); public FormActivity(String tag) { super(tag); } protected abstract void initializeFormFields(); @Override public void setContentView(int layoutResID) { super.setContentView(layoutResID); this.initializeFormFields(); } public void addValidator(IValidator validator) { this.ruleSet.add(validator); } public boolean validateForm() { boolean finalResult = true; for(IValidator validator : this.ruleSet) { boolean result = validator.validate(); if (!result) { finalResult = false; } } return finalResult; } }