

Public class MainActivity extends AppCompatActivity Here is Brief Description on ScanActivity.java

Updating MainActivity.java file: import Here Button will open a new activity with camara for scanning a bar code or QR code a and After successful scanning, system will enter the value of the barcode or QR code in the textview. Updating activity_main.xml file:ĭesigning a user Interface here i have made use of one button and a text view Note: If you are targeting SDK version above 22 (Above Lollipop) then you need to ask a user for granting runtime permissions. įor using camera, we have to get permission from the user device. You need to add camera permission between …. tag in androidManifest.xml file. Here i am using ZBar github library , but you can also use ZXing.Īdd camera permission to your AndroidManifest.xml file: implementation 'me.dm7.barcodescanner:zbar:1.9.13' Add dependencies in adle(Module:app) fileĪdd the following dependency to your adle (Module : app) file.
