Closed calbert52 closed 8 years ago
I'm getting the same thing except I get the exception when I call the Scan() method
Correct, it was on the Scan() method
I updated the package and still experience this. This seems to only happening on Android when calling the Scan(). It gives this error on Xamarin Studio: "Object reference not set to an instance of an object."
I am using a Galaxy S5 Samsung API 23
I had the same issue, but got it to work using the following line in my Android Project in MainActivity.cs in OnCreate:
ZXing.Mobile.MobileBarcodeScanner.Initialize(Application);
IT WORKS!! Thank you. Thank you. Thank you
Hey folks, glad you've got it sorted. It's a minor annoyance, but it is in the README and sample forms app, so when in doubt, always check how the sample does it!
I am pretty sure that I followed the same coding pattern as in the sample forms project, but I still get the same error.
Android MainActivity code in OnCreate global::ZXing.Net.Mobile.Forms.Android.Platform.Init();
Included: public override void OnRequestPermissionsResult(....) { global::ZXing.Net.Mobile.Forms.Android.PermissionsHandler.OnRequestPermissionsResult( requestCode, permissions, grantResults); }
I have a custom ViewCell that creates a Entry control and a Button to click to scan a barcode. When I click on the button that executes the below code, I still get the following exception "Object reference not set to an instance of an object", when I execute scanner.Scan();
var scanner = new MobileBarcodeScanner(); scanner.TopText = "Top text"; scanner.BottomText ="Bottom text"; var result = await scanner.Scan();
Nowhere in the readme does it mention that you need to call ZXing.Mobile.MobileBarcodeScanner.Initialize(Application);
Cannot get to work with Xamarin.Forms v2.3.1.114 using either ZXingScannerPage() or MobileBarcodeScanner() approaches. Get System.NullReferenceException after trying to create:
new ZXingScannerPage(null, null) or new MobileBarcodeScanner()