java - Android Data Validation -


i wondering effective form of data validation android. so, when getting value edittext how should value given validated before used? check make sure string returned gettext().tostring() not null or empty using guava library:

strings.isnullorempty(edittext.gettext().tostring())

then, depending on type of data expecting, create method see if data can parsed. if expecting double create method this:

private boolean isdouble(string string) {     try {         double stringdouble = double.parsedouble(string);         return true;     } catch (exception e)     {         return false;     } } 

is there simpler way without need create separate method each type of data expecting receive?

i've used edittext-validator last time needed quick validation. works charm :)

https://github.com/vekexasia/android-edittext-validator


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -