Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QRCodeWriter writer = new QRCodeWriter();
- try {
- BitMatrix bitMatrix = writer.encode(content, BarcodeFormat.QR_CODE, 512, 512);
- int width = bitMatrix.getWidth();
- int height = bitMatrix.getHeight();
- Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
- for (int x = 0; x < width; x++) {
- for (int y = 0; y < height; y++) {
- bmp.setPixel(x, y, bitMatrix.get(x, y) ? Color.BLACK : Color.WHITE);
- }
- }
- ((ImageView) findViewById(R.id.img_result_qr)).setImageBitmap(bmp);
- } catch (WriterException e) {
- e.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement