//zxing
compile 'com.google.zxing:core:3.3.0'
compile 'com.google.zxing:javase:3.3.0'


public static byte[] getQRCodeImage(String text, int width, int height) {
QRCodeWriter qrCodeWriter = new QRCodeWriter();
try{
BitMatrix bitMatrix = qrCodeWriter.encode(text, BarcodeFormat.QR_CODE, width, height);
ByteArrayOutputStream pngOutputStream = new ByteArrayOutputStream();
MatrixToImageWriter.writeToStream(bitMatrix, "PNG", pngOutputStream);
byte[] pngData = pngOutputStream.toByteArray();
return pngData;
}catch (Exception e){
e.printStackTrace();
}
return null;
}