Created
February 17, 2013 20:34
-
-
Save antew/4973312 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns true if the username and password pass validation. | |
* | |
* @return False if the username or password is blank | |
*/ | |
private boolean hasErrors() { | |
boolean hasErrors = false; | |
Drawable errorIcon = getErrorDrawable(); | |
String errorText = null; | |
if (username.getText().length() == 0) { | |
errorText = getString(R.string.enter_a_username); | |
username.setError(errorText, errorIcon); | |
hasErrors = true; | |
} | |
if (password.getText().length() == 0) { | |
errorText = getString(R.string.enter_a_password); | |
password.setError(errorText, errorIcon); | |
hasErrors = true; | |
} | |
return hasErrors; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment