import java.util.Hashtable;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Vector;
+import java.util.concurrent.CountDownLatch;
/**
* This thread does all the heavy lifting of decoding the images.
/**
* This thread does all the heavy lifting of decoding the images.
private final CaptureActivity activity;
private final Hashtable<DecodeHintType, Object> hints;
private Handler handler;
private final CaptureActivity activity;
private final Hashtable<DecodeHintType, Object> hints;
private Handler handler;
+ private final CountDownLatch handlerInitLatch;
DecodeThread(CaptureActivity activity,
Vector<BarcodeFormat> decodeFormats,
DecodeThread(CaptureActivity activity,
Vector<BarcodeFormat> decodeFormats,
ResultPointCallback resultPointCallback) {
this.activity = activity;
ResultPointCallback resultPointCallback) {
this.activity = activity;
+ handlerInitLatch = new CountDownLatch(1);
hints = new Hashtable<DecodeHintType, Object>(3);
hints = new Hashtable<DecodeHintType, Object>(3);
+ try {
+ handlerInitLatch.await();
+ } catch (InterruptedException ie) {
+ // continue?
+ }
return handler;
}
@Override
public void run() {
Looper.prepare();
return handler;
}
@Override
public void run() {
Looper.prepare();
- handler = new DecodeHandler(activity, hints);
+ handler = new DecodeHandler(activity, hints);
+ handlerInitLatch.countDown();