代码如下:
public static Bitmap createQRCode(String content, int width, int height) {
try {
BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
Bitmap bitmap = barcodeEncoder.encodeBitmap(new String(content.getBytes("UTF-8"),"ISO-8859-1"),
BarcodeFormat.QR_CODE, width, height);
return bitmap;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
网友评论