code: public Integer getAsInteger(String key) {
          Object value = mValues.get(key);
          try {
              return value != null ? ((Number) value).intValue() : null;
          } catch (ClassCastException e) {
              if (value instanceof CharSequence) {
                  try {
                      return Integer.valueOf(value.toString());
                  } catch (NumberFormatException e2) {
                      DLog.e(TAG, "Cannot parse Integer value for " + value + " at key " + key);
                      return null;
                  }
              } else {
                  DLog.e(TAG, "Cannot cast value for " + key + " to a Integer: " + value, e);
                  return null;
              }
          }
      }
docs: Gets a value and converts it to an Integer.
  
  @param key the value to get
  @return the Integer value, or null if the value is missing or cannot be converted