protected override void OnResume() { base.OnResume(); ScannerView.SetResultHandler(this); ScannerView.StartCamera(CameraId); ScannerView.Flash = Flash; ScannerView.SetAutoFocus(AutoFocus); }
//private Button urlButton; protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); //Init view txtResult = FindViewById <TextView>(Resource.Id.txt_result); scannerView = FindViewById <ZXingScannerView>(Resource.Id.zxscan); open_link_button = FindViewById <Button>(Resource.Id.link_button); break_button = FindViewById <Button>(Resource.Id.break_button); //urlButton = FindViewById<Button>(Resource.Id.url_button); //Request permission Dexter.WithActivity(this) .WithPermission(Manifest.Permission.Camera) .WithListener(this) .Check(); open_link_button.Click += (sender, e) => { if (UrlString != "") { Xamarin.Essentials.Browser.OpenAsync(UrlString); } }; break_button.Click += (sender, e) => { scannerView.SetResultHandler(new MyResultHandler(this)); scannerView.StartCamera(); }; }