任何人都可以提供使用此链接中提供的适用于Android 4.1和4.2的Camera API的示例代码:Link
我目前正在将此代码用于旧版本,但它在Jellybean设备中不起作用
AutoFocusCallback myAutoFocusCallback = new AutoFocusCallback() {
@Override
public void onAutoFocus(boolean arg0, Camera arg1) {
// TODO Auto-generated method stub
if (arg0) {
if (mPreviewRunning) {
mCamera.takePicture(myShutterCallback, mPicture, mPicture);
}
} else {
flKeepClean.setVisibility(View.VISIBLE);
btnCamera.setEnabled(true);
side.setEnabled(true);
}
}
};
ShutterCallback myShutterCallback = new ShutterCallback() {
@Override
public void onShutter() {
// TODO Auto-generated method stub
}
};
答案 0 :(得分:0)
对于迟到的更新感到抱歉。问题是设备没有自动对焦。因此,您需要先检查设备是否具有自动对焦功能: boolean focus = getPackageManager()。hasSystemFeature(“android.hardware.camera.autofocus”);