QR code scanner
2
QR AND BAR CODE SCANNER
Convert view:
IMPORT:
com.budiyev.android.codescanner.CodeScannerView
Change ID:
scanner
Inject xml:
app:autoFocusButtonColor="@android:color/white"
app:autoFocusButtonVisible="true"
app:flashButtonColor="@android:color/white"
app:flashButtonVisible="true"
app:frameColor="@android:color/white"
app:frameCornersSize="50dp"
app:frameCornersRadius="0dp"
app:frameAspectRatioWidth="1"
app:frameAspectRatioHeight="1"
app:frameSize="0.75"
app:frameThickness="2dp"
app:maskColor="#77000000"
Java
IMPORT:
com.google.zxing.Result
Custom variable :
CodeScanner CodeScanner
On create:
CodeScannerView scannerView = findViewById(R.id.scanner);
CodeScanner = new CodeScanner(this, scannerView);
CodeScanner.startPreview();
CodeScanner.setDecodeCallback(new DecodeCallback() {
@Override public void onDecoded(
final Result result) { runOnUiThread(new Runnable() {
@Override
public void run() {
String sresult = result.getText();
//do your actions here
} }
); }
}
);