0
我跟隨由拉爾斯·沃格爾教程在Tutorial LinkAndroid的後置攝像頭拍攝照片,而不預覽
雖然本教程作品完美的前置攝像頭我遺憾的是不能得到的後置攝像頭拍攝照片。它遲到了,我可能錯過了一些簡單的東西。我的代碼是:
private int findBackFacingCamera() {
int cameraId = 0;
// Search for the back facing camera
int numberOfCameras = Camera.getNumberOfCameras();
for (int i = 0; i < numberOfCameras; i++) {
CameraInfo info = new CameraInfo();
Camera.getCameraInfo(i, info);
if (info.facing == CameraInfo.CAMERA_FACING_BACK) {
Log.d(DEBUG_TAG, "Camera found" + info.facing);
cameraId = i;
break;
}
}
return cameraId;
}