赞
踩
API文档
根据Android developers guide的android.hardware.Camera,他们状态:
We recommend using the new 07001 API for new applications.
在关于android.hardware.camera2的信息页面(上面链接),它说:
The android.hardware.camera2 package provides an interface to individual camera devices connected to an Android device. It replaces the deprecated Camera class.
问题
当你检查文档,你会发现这两个Camera API的实现是非常不同的。
例如在android.hardware.camera上获取摄像头方向
@Override
public int getOrientation(final int cameraId) {
Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(cameraId, info);
return info.orientation;
}
与android.hardware.camera2
@Override
public int getOrientation(final int cameraId) {
try {
CameraManager manager = (CameraManager) context.getSystemService(C
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。