With the following code the QR Code appears blank in the Blackberry screen, I don’t know what I’m missing. It shows a square centered correctly, but the square itself is white, with no QR code inside.
Any help is appreciated. Thanks.
public QRCodeScreen(String qrCode) {
this.qrCode = "Test String";
qrImage = new BitmapField(new Bitmap(QRCODE_WIDTH, QRCODE_WIDTH),FIELD_HCENTER);
qrImage.setBorder(BorderFactory.createBevelBorder(new XYEdges(2, 2, 2, 2)));
Hashtable hintMap = new Hashtable();
hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
try {
MultiFormatWriter barcodeWriter = new MultiFormatWriter();
ByteMatrix byteMatrix = barcodeWriter.encode(this.qrCode, BarcodeFormat.QR_CODE, QRCODE_WIDTH, QRCODE_WIDTH,hintMap);
Bitmap bitmap = BarcodeBitmap.createBitmap(byteMatrix, 256);
qrImage.setBitmap(bitmap);
}
catch (Exception e) {
}
add(qrImage);
}
}
Have a look at this sample from the BlackBerry online docs
If you simply modify it to fit your code above, you get:
That works for me, on a 6.0 9800 simulator (running your original code produced the blank image as you described).