0

Barcode Reader - Google Mobile Vision

https://github.com/ravi8x/Barcode-Reader

    <fragment
    android:id="@+id/barcode_scanner"
    android:name="info.androidhive.barcode.BarcodeReader"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:auto_focus="true"
    app:use_flash="false"
     />

There is an app:use_flash feature, but only in XML I can't get it accessed in java file, and there is no code about obtaining it in a sample app.

Also, I want to know if loading the QR image from the gallery and scan its features is included in this library.

Maxim Kirilov
  • 2,639
  • 24
  • 49
Abdul Manan
  • 43
  • 1
  • 9
  • Possible duplicate of [How to turn on front flash light programmatically in Android?](https://stackoverflow.com/questions/6068803/how-to-turn-on-front-flash-light-programmatically-in-android) – Stanley Ko Mar 20 '19 at 07:09
  • I have tried that code but it initialize the camera from start because of that the scanner camera stops working .........can't find a way around it....... – Abdul Manan Mar 20 '19 at 09:33

1 Answers1

0

The library doesn't expose it. So you got two options:

  1. Add the library as a library module in your app, and change the class to do whatever you want ( including adding a parameter to toggle flash ).
  2. Create a class extending that fragment, override onInflate and change the isFlash there to whatever you want. It's private, so you'll have to use reflection.
Rick Sanchez
  • 4,528
  • 2
  • 27
  • 53