10-17-2010 07:23 AM
Hi all,
I'm a new to blackberry development and I'm trying to scan a Bar Code. The
below code snippet works fine for QR Code format but what I wanted is to scan a
EAN 13 Bar Code, I just changed one line in the below code i.e.,
formats.addElement(BarcodeFormat.EAN_13);
where the original code for QR Code is as depicted below
formats.addElement(BarcodeFormat.QR_CODE);
private void scanBarcode()
{
// If we haven't scanned before, we will set up our barcode scanner
if (_barcodeScreen == null) {
Hashtable hints = new Hashtable();
Vector formats = new Vector();
formats.addElement(BarcodeFormat.EAN_13);
hints.put(DecodeHintType.POSSIBLE_FORMATS, formats);
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
BarcodeDecoder decoder = new BarcodeDecoder(hints);
try {
_scanner = new BarcodeScanner(decoder, new MyBarcodeDecoderListener());
_barcodeScreen = new MyBarcodeScannerViewScreen(_scanner);
} catch (Exception e) {
log("Could not initialize barcode scanner: " + e);
return;
}
}
try {
_scanner.startScan();
_app.pushScreen(_barcodeScreen);
} catch (Exception e) {
log("Could not start scan: " + e);
}
}
any help in this regard would be highly appreciated........
regards,
$aran.......
10-17-2010 10:08 PM
Hello, I needed to decode QR code and that code example worked well for me. I guess you should play with com.google.zxing.oned.* instead of com.google.zxing.qrcode.*
Bob
10-18-2010 04:54 AM
hi can any one provide sample codes for scanning EAN 13 format barcode or
is there any errors in the above depicted code, Its urgent..................please help me
03-10-2011 09:17 AM
Haved someone find a solution i am having some problems barcode 128 and 39
tks
r.sole
03-29-2011 10:29 AM
Up for this very interesting post.
I was able to decode at the same time QR and EAN_13 with the following code :
Hashtable hints = new Hashtable(1); Vector formats = new Vector(); formats.addElement(BarcodeFormat.QR_CODE); formats.addElement(BarcodeFormat.EAN_13); hints.put(DecodeHintType.POSSIBLE_FORMATS, formats); // Initialize the BarcodeDecoder BarcodeDecoder decoder = new BarcodeDecoder(hints);
The tips was to present the EAN_13 on a vertical way, it is not found on an horizontal one.
12-09-2011 12:57 AM
12-15-2011 07:35 AM