Android
0
Вклад в тег
ImageScanner scanner;
Camera.PreviewCallback previewCb = new Camera.PreviewCallback() {
public void onPreviewFrame(byte[] data, Camera camera) {
Camera.Parameters parameters = camera.getParameters();
Camera.Size size = parameters.getPreviewSize();
Image barcode = new Image(size.width, size.height, "Y800");
barcode.setData(data);
int result = scanner.scanImage(barcode);
if (result != 0) {
previewing = false;
mCamera.setPreviewCallback(null);
mCamera.stopPreview();
String resultText = null;
SymbolSet syms = scanner.getResults();
for (Symbol sym : syms) {
// scanText.setText("barcode result " + sym.getData());
resultText = sym.getData();
barcodeScanned = true;
}
String[] splitResult = resultText.split(";");
if (splitResult.length == 2)
dlgScannerResult(splitResult[0],splitResult[1]).show();
else
resetScanner();
}
}
};