Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 122
Registered: ‎09-15-2010
My Device: BB - 9800

Scanning EAN 13 Bar Code

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.......

 

 

Contributor
Posts: 20
Registered: ‎10-11-2010
My Device: Not Specified

Re: Scanning EAN 13 Bar Code

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

Developer
Posts: 122
Registered: ‎09-15-2010
My Device: BB - 9800

Re: Scanning EAN 13 Bar Code

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 

Regular Contributor
Posts: 67
Registered: ‎11-14-2010
My Device: 9900 7.0 PAQUETE 2395 (V7.0.0.579,PLATAFORMA 5.0.0.735)
My Carrier: MOVISTAR Venezuela

Re: Scanning EAN 13 Bar Code

Haved someone find a solution i am having some problems barcode 128 and 39

tks

r.sole

Highlighted
Contributor
Posts: 30
Registered: ‎03-24-2011
My Device: 9800
My Carrier: sfr

Re: Scanning EAN 13 Bar Code

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.

 

Developer
Posts: 60
Registered: ‎05-04-2011
My Device: Torch 9800, Bold 9700, Curve 9380
My Carrier: None

Re: Scanning EAN 13 Bar Code

I tried to scan the EAN-13 code with my device with all possible directions. But i was enable to decode that code.
Developer
Posts: 60
Registered: ‎05-04-2011
My Device: Torch 9800, Bold 9700, Curve 9380
My Carrier: None

Re: Scanning EAN 13 Bar Code

Finally i able to decode the EAN-13 barcode. But now i want to decode that string to actual data i.e. to which product it refers.

Like i have 5901234123457(Wikipedia EAN-13 image's output) as the result after decoding that EAN-13 code. But now can i use this code much further(like to which country it belongs, product name and more info).

Is it possible in BB ?
If yes, then please share.