From 8518e8c4205f2aebffd7bbdcf6964b6f828ab54f Mon Sep 17 00:00:00 2001 From: Terry May Date: Wed, 14 Nov 2012 12:47:21 -0500 Subject: [PATCH] added check to autofocus handler to know if the activity is complete or not. this prevents an autofocus exception. --- .../com/dm/zbar/android/scanner/ZBarScannerActivity.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ZBarScannerLibrary/src/com/dm/zbar/android/scanner/ZBarScannerActivity.java b/ZBarScannerLibrary/src/com/dm/zbar/android/scanner/ZBarScannerActivity.java index c9e2f4f..086a066 100644 --- a/ZBarScannerLibrary/src/com/dm/zbar/android/scanner/ZBarScannerActivity.java +++ b/ZBarScannerLibrary/src/com/dm/zbar/android/scanner/ZBarScannerActivity.java @@ -21,7 +21,8 @@ public class ZBarScannerActivity extends Activity implements Camera.PreviewCallb private Camera mCamera; private ImageScanner mScanner; private Handler mAutoFocusHandler; - + private boolean complete; + static { System.loadLibrary("iconv"); } @@ -94,7 +95,7 @@ public void onPreviewFrame(byte[] data, Camera camera) { if (result != 0) { mCamera.setPreviewCallback(null); mCamera.stopPreview(); - + complete = true; SymbolSet syms = mScanner.getResults(); for (Symbol sym : syms) { String symData = sym.getData(); @@ -111,7 +112,7 @@ public void onPreviewFrame(byte[] data, Camera camera) { } private Runnable doAutoFocus = new Runnable() { public void run() { - if(mCamera != null) { + if(mCamera != null && !complete) { mCamera.autoFocus(autoFocusCB); } }