Camera
미리보기, 사진 찍기 및 확대/축소 기능을 사용하는 응용 프로그램을 개발 중입니다.Android API 7 (2.1 Eclair)에서 카메라 문자열 매개 변수
내가 구현하지 않는 안드로이드 API 레벨 7 (2.1 에클 레어)와 호환성을 유지하기 위해 노력하고 Camera.Parameters.getMaxZoom()
, Camera.Parameters.setZoom()
, 등, 그래서 하드웨어에 의해 반환 된 String
매개 변수를 사용해야합니다. 예를 들어 :
final String zoomSupportedString = parameters.get("zoom-supported"); // parameters is a Camera.Parameters
final boolean zoomSupported = (zoomSupportedString != null ? Boolean.parseBoolean(zoomSupportedString) : false);
if (zoomSupported) {
// Computes the min an max zoom levels for taking a picture:
final int minTake = parameters.getInt("taking-picture-zoom-min");
final int maxTake = parameters.getInt("taking-picture-zoom-max");
// etc.
}
그러나 모든 장치는 동일한 매개 변수를 사용하여, 나는 인터넷에 유효한 카메라 매개 변수 목록을 찾을 수 없습니다. HTC에 Camera.Parameters.flatten()
에 의해 반환 된 값을 (doc 참조)를 확인하여
나는 "zoom-supported"
, "taking-picture-zoom-min"
, "taking-picture-zoom-max"
및 "max-zoom"
을 찾을 수 있습니다. 놀랍게도 나는 "min-zoom"
을 발견하지 못했습니다.
그러나 매개 변수 "taking-picture-zoom-min"
예를 들어, 삼성 갤럭시 S에 존재하지 않으며, 이것은 NumberFormatException: 'null' cannot be parsed as an integer
을 던져 반환되는 null
및 getInt()
을 이끌고 있습니다.
Android-7과 호환되도록 노력하고 있다는 것을 알고 있다면 하드웨어에서 반환 한 문자열 값을 사용하는 것보다 줌을 처리하는 더 좋은 방법이 있습니까? 그렇다면 모든 유효한 줌 매개 변수 목록 (또는 공급 업체별 목록)을 어딘가에서 찾을 수 있습니까?