public static int parseInt ( String val , int defValue ) { if ( TextUtils . isEmpty ( val ) ) return defValue ; try { return Integer . parseInt ( val ) ; } catch ( NumberFormatException e ) { return defValue ; } }
Parse a int from a String in a safe manner .