0

i've a question for you about Xamarin Zxing Forms library. I was playing with the ZxingScannerView object with his own method get and set bool IsScanning and IsAnalizing. On my custom overlay i've setted an option button which open a new page and i played to test it with his orientation device situation for every operation system, like Android or Ios. Ios works very well, but for Android i've a problem about the camera device, when crashed my app into the NullReferenceException.

System.NullReferenceException: Object reference not set to an instance of an object.

My code to set the page to view with navigation Page and set the scanner option are these

        scanner.IsAnalyzing = false;
        scanner.IsScanning = true;
        NavigationPage nav = new NavigationPage(new Page());
        Navigation.PushModalAsync(nav);

And also i've managed these with his override method on Appear and Disappear situation

protected override void OnAppearing()
    {
        base.OnAppearing();
        scanner.IsEnabled = false;
        scanner.IsAnalyzing = false;
        scanner.IsScanning = false;
    }

    protected override void OnDisappearing()
    {
        base.OnDisappearing();

        scanner.IsEnabled = true;
        scanner.IsAnalyzing = true;
        scanner.IsScanning = true;
    }

Anyone has got the solution about these problem?

  • I used `MainPage` with `MobileBarcodeScanner`, works fine, based on your code `NavigationPage nav = new NavigationPage(new Page());` and `Navigation.PushModalAsync(nav);`, it seems that you used a `NavigationPage` inside of another `NavigationPage`? Where're you using this code? Can you please show more code of your page? – Grace Feng Jul 17 '17 at 09:38
  • No i've not use a NavigationPage inside another NavigationPage into my code project. The simple line of the Mainpage class is easy MainPage = new ScanPage(); and also the settings about my ZxingScannerView are these zxing = new ZXing.Net.Mobile.Forms.ZXingScannerView() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, AutomationId = "zxingScannerView", Options = options }; – Simone Attrotto Jul 17 '17 at 09:45

0 Answers0