Domanda

I'm able to successfully integrate barcode scanner using zxing library to make a standalone scanner. The problem that is coming in my application is the autofocus. Camera in my app is taking the initial focus and is not resetting. for eg. if initially I point my camera to dark surface and then I focus it to the page having the barcode, the text on the page is not even visible. the contrast is too high. and this contrast is not resetting like in barcode scanner app by zxing.

I have seen other apps like pvr cinemas which are using zxing library and on my device they are working fine in regards to this issue. Their focus is getting reset.

I have followed this tutorial

È stato utile?

Soluzione

I had commented out the part

task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, args);

Thanks for pointing out AutofocusManager I added

if (Build.VERSION.SDK_INT >= 11 ) {
                         // changed to 11 as Build.VERSION_CODES.HONEYCOMB is not
                         // accessible on android platform prior to 3.0
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, args);
} else {
    task.execute(args);
}

in HoneycombAsyncTaskExecInterface

Now its working fine. Thanks @Sean Owen

Altri suggerimenti

You probably modified the scan-focus loop and caused it to stop working. Look at how AutofocusManager triggers focus, waits for the preview frame, and then is triggered again. You need to debug this part to see what you changed.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top