I'm implementing an Activity that uses a CameraSource and SurfaceView(to 
show the camera's view) along with the new BarcodeDetector API and after 
detection I'm trying to perform a finish() but it doesn't go back to the 
prior Activity it just keeps running this one.

Here is a code snippet from my onCreate Activity, as you can see once I 
detect a barcode I attempt to call finish but it doesn't seem to do 
anything.
Is there something I have to shutdown prior to this?

I'm testing on a real device using Android 4.4.4

barcodeDetector = new BarcodeDetector.Builder(context).build();
barcodeDetector.setProcessor(new 
FocusingProcessor<Barcode>(barcodeDetector, new Tracker<Barcode>()) {

@Override
public void receiveDetections(Detections<Barcode> detections) {
if(detections != null) {
SparseArray<Barcode> barcodes = detections.getDetectedItems();
if(barcodes != null && barcodes.size() > 0) {
int key = barcodes.keyAt(0);
Barcode bc = barcodes.get(key);
if(bc != null) {
barcode = bc.rawValue;
Intent resultData = new Intent();
resultData.putExtra("BARCODE", barcode);
setResult(Activity.RESULT_OK, resultData);
curActivity.finish();
}
}
}
}
}

@Override
public void release() {
super.release();
}

@Override
public int selectFocus(Detections<Barcode> arg0) {
return 0;
}
});
mCameraSource = new CameraSource.Builder(context, barcodeDetector)
                .setFacing(CameraSource.CAMERA_FACING_BACK)
                .build();


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to