Skip to content

Instantly share code, notes, and snippets.

@ahn94
Created July 12, 2015 01:06
Show Gist options
  • Save ahn94/5cfd0596adbb8c8c7002 to your computer and use it in GitHub Desktop.
Save ahn94/5cfd0596adbb8c8c7002 to your computer and use it in GitHub Desktop.
Extract and validate textview input
private boolean isInt(TextField input, String message){
try {
int age = Integer.parseInt(input.getText());
System.out.println("user is: " + age);
return true;
} catch (NumberFormatException e){
System.out.println("Error: " + message + " is not a number");
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment