Forum Xamarin.Android

ZXingBarcodeScanner problems - NullPointerReference

Hello world!

I'm trying to use the ZXing for Mono for Android in my project. I've used this code to call my scanner/camera, however it crashes on

ZXing.Result result = await _scanner.Scan();

With result being NULL. I get a "Java.Lang.NullPointerException".

Ideas?

    `private async void _imgbtnScan_Click(object sender, EventArgs e)
    {

        _scanner.UseCustomOverlay = false;

        _scanner.TopText = "TEMP TEMP";
        _scanner.BottomText = "TEMP TEMP";

        ZXing.Result result = await _scanner.Scan();

        HandleScanResult(result);

    }

    private void HandleScanResult(ZXing.Result result)
    {
        string msg = string.Empty;

        if (result != null && !string.IsNullOrEmpty(result.Text))
            msg = result.Text;

        _scanResult = msg;
    }`

Posts

Sign In or Register to comment.