重复扫描处理
initCamera();
if (mHandler != null)
mHandler.restartPreviewAndDecode();
在扫描完毕后执行这3句即可。
说明:
1.扫描处理方法为CaptureActivity的handleDecode方法,所以这3句加在最后即可。
2.initCamera方法是有参数的,可参考onResume方法改为
SurfaceView surfaceView = (SurfaceView)findViewById(R.id.preview_view);;
SurfaceHolder surfaceHolder = surfaceView.getHolder();
initCamera(surfaceHolder);
3.mHandler即为当前Activity中的CaptureActivityHandler
4.restartPreviewAndDecode方法在com.zxing.decoding.CaptureActivityHandler中,要改为public
取景框拉伸处理
Zxing 修改 CameraConfigurationManager.java文件的
void initFromCameraParameters(Camera camera)方法
在 Log.d(TAG, "Screen resolution: " + screenResolution);这句之后增加
Point screenResolutionForCamera = new Point();
screenResolutionForCamera.x = screenResolution.x;
screenResolutionForCamera.y = screenResolution.y;
// preview size is always something like 480*320, other 320*480
if (screenResolution.x < screenResolution.y) {
screenResolutionForCamera.x = screenResolution.y;
screenResolutionForCamera.y = screenResolution.x;
}
在把其后的
cameraResolution = getCameraResolution(parameters, screenResolution);
中的screenResolution改为 screenResolutionForCamera
如下:
cameraResolution = getCameraResolution(parameters, screenResolutionForCamera);
由于网上找到的方法只试用于480*320,所以有些机型拉伸情况还是很严重,谁有解决的方法请告知给我,小编不胜感激,谢谢
处理远距离扫描
很简单,就是把zxing.jar换成core.jar,然后开始骂爹骂娘,啊啊啊啊