Answer the question
In order to leave comments, you need to log in
How to parse string received from zxing?
I am writing an android plugin for an application on unity3d. They pushed zxing into unity, only a line is thrown into the plugin for me.
How to parse it? in zxing, you need to pass an instance of Result to the parser, but where can I get it?
Or tell me a good and simple library for parsing a string with the result of a QR code scan, VCARD is required
Answer the question
In order to leave comments, you need to log in
I use the Zbar library to recognize the QR code from the camera.
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();
}
}
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question