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

Regular Contributor
Posts: 55
Registered: ‎09-01-2010
My Device: Not Specified

QR code decoding problem in OS 6

I am using the following code for 2D-QR code decoder.


package com.test.rim;

import java.util.*;

import net.rim.device.api.barcodelib.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.UiApplication;

import net.rim.device.api.ui.component.Dialog;

import com.google.zxing.*;

final class BarcodeScanScreen extends MainScreen{
    BarcodeScanScreen barcodeScanScreen;
        BarcodeDecoderListener listener = new BarcodeDecoderListener(){
            public void barcodeDecoded( String rawText )

        Hashtable hints = new Hashtable(1);
        Vector formats  = new Vector(1);
        hints.put(DecodeHintType.POSSIBLE_FORMATS, formats);

        BarcodeDecoder decoder = new BarcodeDecoder( hints );

            BarcodeScanner scanner = new BarcodeScanner( decoder, listener );
            scanner.getVideoControl().setDisplayFullScreen( true );
            add( scanner.getViewfinder() );
        }catch (Exception e)
            // Catch errors here
            Dialog.alert("Error:" + e.getMessage());


To start this screen, I am firing the a code app.pushScreen(new BarcodeScanScreen()); on a button tap from its previous screen.


When I am running the code, the BarcodeScanScreen starts properly and the scanning is also going on(as the red light of the device is blinking). As soon as I place the cam before any valid 2D-QR code, the blink stops. I think it means, any barcode is decoded successfully and therefore the scanner stops. But barcodeDecoded() method is not fired as no alert massage is appear in the screen. What is the problem in my code?