Android Studio BarCode-Scanner Tutorial

Apr 30, 2016

prince

Android

0

Objective: Main Objective of this blog is to explain how to Integrate Barcode Scanner in an Android Studio.

Final output:

 

STEP 1: Create new project in Android Studio.

If you are new to Android Studio and don’t know how to create a new project then you should checkout our blog.

STEP 2: Download Library.

For our Barcode Scanner Android tutorial, we first need to download library for Android.

STEP 3: Add Library into your project. 

After you are done downloading, please add it in Android Studio Project.

  • Way 1: 

    Paste downloaded files into libs folder in your Android Project. This library contains .so files in different folders like: armeabi, armeabi-v7a, x86 and zbar.jar

            

  • Way 2:

    If you don’t want to add .jar into libs directly then add following into your gradle.    

STEP 4: Adding extra two lines in gradle.

Here we use .so files in libs. For this type of library we need following lines in gradle for making it executable.

STEP 5: Adding permission and features into AndroidManifest.xml.

STEP 6: Create SurfaceView for Camera Preview.

Create java class named “CameraPreview” into your package and extends with SurfaceView.

STEP 7: Create layout barcode_cam.xml in res folder and put following code into barcode_cam.xml

STEP 8: In MainActivity.java use following code.

You must add this in your MainActivity.java for load barcode library.

I hope you will find this blog post helpful while working with Barcode-Scanner in Android Application. Let me know in comment if you have any questions regarding Add Barcode -Scanner in Android Application. Please put a comment here and we will get back to you ASAP.

Got an Idea of Android App Development? Why are you still waiting for? Contact us now and see the Idea live soon.

Download Full Source Code FREE!!!

 

Post by prince

Leave a Reply

Your email address will not be published. Required fields are marked *