Robolectric에서 일부 코드, 즉 IntegerResourceLoader
을 만들고 있습니다.16 진수 색상 문자열을 정수로 구문 분석하는 방법
@Override
public Object convertRawValue(String rawValue) {
try {
return Integer.parseInt(rawValue);
} catch (NumberFormatException nfe) {
throw new RuntimeException(rawValue + " is not an integer.");
}
}
내가 Integer.decode(String)를 사용하여 시도하지만 문법이 올 것으로 보인다에도 NumberFormatException이 예외 : rawValue
이 0xFFFF0000과 같은 일이있을 때 다음 방법은 RuntimeException
을 던지고있다.
맞습니다. Long.decode()는이 문제를 해결합니다. 고맙습니다. –