SubscribeSubscribe with Androidlift to get new post on mail.

Android generate Bar Code or QR-Code Example

Android generate Bar Code or QR-Code

QR code (abbreviated from Quick Response Code) is the trademark for a type of matrix barcode (or two-dimensional barcode) first designed for the automotive industry in Japan. Android generate Bar Code or QR-Code .A barcode is a machine-readable optical label that contains information about the item to which it is attached. A QR code uses four standardized encoding modes (numeric, alphanumeric, byte/binary, and kanji) to efficiently store data; extensions may also be used.

The QR code system became popular outside the automotive industry due to its fast readability and greater storage capacity compared to standard UPC barcodes. Applications include product tracking, item identification, time tracking, document management, and general marketing.

A QR code consists of black squares arranged in a square grid on a white background, which can be read by an imaging device such as a camera, and processed using Reed–Solomon error correction until the image can be appropriately interpreted. The required data is then extracted from patterns that are present in both horizontal and vertical components of the image.

Create a new project

To generate Bar Code, we are going to create a new android project. Go to File ⇒ New ⇒ New Projects in Android studio.

Add ZXING library

We need to add ZXING library in our project, so open build.gradle(Module:app) file and add following code:

Create a simple Bar Code/QR-Code

To get QR-Code from text use the following code:

Generate Bar code with set of details

If we want to generate Bar Code with some details then we need to use VCard object to set details.

MainActivity.java

activity_main.xml

AndroidManifest.xml

App build.gradle 

Output :

Android generate Bar Code or QR-Code
Android generate Bar Code or QR-Code

(1903)