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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
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;
    
    BarcodeScanScreen(){
   
        BarcodeDecoderListener listener = new BarcodeDecoderListener(){
                 
            public void barcodeDecoded( String rawText )
            {
                Dialog.alert(rawText);
            }
        };

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

        BarcodeDecoder decoder = new BarcodeDecoder( hints );

        try{
            BarcodeScanner scanner = new BarcodeScanner( decoder, listener );
            scanner.getVideoControl().setDisplayFullScreen( true );
            add( scanner.getViewfinder() );
            scanner.startScan();
        }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?