Skip to content

Commit

Permalink
Merge pull request dm77#3 from tmay/master
Browse files Browse the repository at this point in the history
Fix for an Auto Focus exception
  • Loading branch information
dm77 committed Nov 29, 2012
2 parents 2ee9175 + 8518e8c commit 01ddcc0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -97,7 +98,7 @@ public void onPreviewFrame(byte[] data, Camera camera) {
mCamera.cancelAutoFocus();
mCamera.setPreviewCallback(null);
mCamera.stopPreview();

complete = true;
SymbolSet syms = mScanner.getResults();
for (Symbol sym : syms) {
String symData = sym.getData();
Expand All @@ -114,7 +115,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);
}
}
Expand Down

0 comments on commit 01ddcc0

Please sign in to comment.