I add the following code in b4aZXingLib.java
Create zxinglib is normal, but the reference problem. Zxing ver 2.3
B4X:
/**
* Create QR Code
* @param str
* @author chjk
* @return Bitmap
* @throws WriterException
*/
public Bitmap Create2DCode(String str) throws WriterException, UnsupportedEncodingException {
BitMatrix matrix = new MultiFormatWriter().encode(new String(str.getBytes("GBK"),"ISO-8859-1"),BarcodeFormat.QR_CODE, 300, 300);
int width = matrix.getWidth();
int height = matrix.getHeight();
int[] pixels = new int[width * height];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
if(matrix.get(x, y)){
pixels[y * width + x] = 0xff000000;
}
}
}
//int[] colors={R.color.white};
Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bmp.setPixels(pixels, 0, width, 0, 0, width, height);
return bmp;
}
}