Android Studio Barcode Reader App [ With Source Files]

The suitable Android Studio Barcode Reader App that you can use for your study project or just for fun and experience. Project files , neccessary class imports and plugins are included in the project files.

Steps to Use:

  1. Insert the barcode reader dependency in app’s build.gradle
  1. Add the barcode reader fragment to your activity
  1. Implement your activity from BarcodeReader.BarcodeReaderListener and override the necessary methods.

Adding Barcode Reader in Fragment

In fragment the barcode reader can be added easily but the scanner listener barcodeReader.setListener() has to be set manually.

Check the example fragment code in BarcodeFragment.java and BarcodeFragmentTestActivity.java

Adding Scanner Overlay Scanning Indicator

The overlay animation indicator displays a horizontal line animating from top to bottom. This will be useful to to show some cool animation to indicate scanning progress.

To use it, add the info.androidhive.barcode.ScannerOverlay on top of barcode reader fragment using Relative or Frame layout.

Additional Options

XML attribute for Barcode Reader

auto_focus – boolean, turn on/off auto focus. Default is true

use_flash – boolean, turn on/off flash. Default is false

XML attribute for Scanner Overlay Indicator

square_width – Width of transparent square

square_height – Height of transparent square

line_color – Horizontal line color

line_speed – Horizontal line animation speed


JAVA Methods

  • Play beep sound

You can play the beep sound when the barcode is scanned. This code is usually called in onScanned() callback.

  • Change beep sound

You can change the default beep sound by passing the file name. You beep file should be in project’s assets folder.

  • Pause scanning

The scanning can be paused by calling pauseScanning() method.

  • Resume Scanning

The scanning can be resumed by calling resumeScanning() method.

Unlock the file by completing small task below. Download will be unlocked as soon as you finish it.

[sociallocker]

[/sociallocker]

You may also like...