Updated 18 December 2017
In this blog we will know about how to generate QR Code. I have used many library that generate QR code but the best one is androinmads Library.
what is the QR code – QR is an acronym for Quick Response. It’s a smarter version of the barcode, and it was originally developed in Japan for the automotive industry. Machines can read QR codes more quickly than barcodes, and QR codes can store more data in less space too.
Generating QR code-
1 |
compile 'androidmads.library.qrgenearator:QRGenearator:1.0.3' |
1 |
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> |
1 2 3 4 5 6 7 8 9 |
QRGEncoder qrgEncoder = new QRGEncoder("company_id=" + companyId, null, QRGContents.Type.TEXT, (int) (MainActivity.screen_width / 1.5)); try { // Getting QR-Code as Bitmap Bitmap bitmap = qrgEncoder.encodeAsBitmap(); // Setting Bitmap to ImageView ((ImageView)profileView.findViewById(R.id.qr_image)).setImageBitmap(bitmap); } catch (WriterException e) { Log.v("QRERROR", e.toString()); } |
1 2 |
// Save with location, value, bitmap returned and type of Image(JPG/PNG). QRGSaver.save(savePath, edtValue.getText().toString().trim(), bitmap, QRGContents.ImageType.IMAGE_JPEG); |
For Scanning QR code look
References https://github.com/androidmads/QRGenerator
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.