本文整理汇总了Java中com.google.zxing.client.android.camera.CameraManager.setManualCameraId方法的典型用法代码示例。如果您正苦于以下问题:Java CameraManager.setManualCameraId方法的具体用法?Java CameraManager.setManualCameraId怎么用?Java CameraManager.setManualCameraId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.client.android.camera.CameraManager
的用法示例。
在下文中一共展示了CameraManager.setManualCameraId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openDriver
import com.google.zxing.client.android.camera.CameraManager; //导入方法依赖的package包/类
private void openDriver(SurfaceHolder surfaceHolder) {
notifyListenerPrepareOpen();
if (surfaceHolder == null)
return;// 已经销毁
if (isOpen())
return;// 摄像头已经打开
if (Compat.checkSelfPermission(getContext(), Manifest.permission.CAMERA)
== PackageManager.PERMISSION_DENIED) {
mErrorCode = ERROR_CODE_1;
notifyListenerError();
return;
}
mCameraManager = new CameraManager(getContext());
if (mCameraId != OpenCameraInterface.NO_REQUESTED_CAMERA)
mCameraManager.setManualCameraId(mCameraId);
final int width = mScanWidth == ViewGroup.LayoutParams.MATCH_PARENT ? getWidth() :
(mScanWidth > getWidth() ? getWidth() : mScanWidth);
final int height = mScanHeight == ViewGroup.LayoutParams.MATCH_PARENT ? getHeight() :
(mScanHeight > getHeight() ? getHeight() : mScanHeight);
mCameraManager.setManualFramingRect(width, height);
try {
mCameraManager.openDriver(surfaceHolder);
mCameraManager.startPreview();
mScanHandler = new ScanHandler(resultListener, mBarcodeType, mBaseHints,
mCharacterSet, mCameraManager,
resultPointCallback);
} catch (Exception e) {
mErrorCode = ERROR_CODE_0;
notifyListenerError();
return;
}
mAmbientLightManager.resume();
notifyListenerOpened();
}