code: public static double parseDouble(String val, double defValue){
          if(TextUtils.isEmpty(val)) return defValue;
          try{
              return Double.parseDouble(val);
          }catch(NumberFormatException e){
              return defValue;
          }
      }
docs: Parse a double from a String in a safe manner
  
  @param val           the string to parse
  @param defValue      the default value to return in parsing fails
  @return              the parsed double, or default value