public void ReceiveDetections(Detector.Detections detections)
        {
            SparseArray items = detections.DetectedItems;



            if (items.Size() != 0)
            {
                textView.Post(() =>
                {
                    var sb = new StringBuilder();

                    sb.Append("Cash Register Number: " + LotteryTextValidation.CashRegisterNumber + "\n");

                    sb.Append("Date: " + LotteryTextValidation.ReceiptDate + "\n");
                    sb.Append("Receipt Number: " + LotteryTextValidation.ReceiptNumber + "\n");

                    textView.Text = sb.ToString();
                    if (LotteryTextValidation.ValidateLotteryReceipt(items))
                    {
                        dictionary = LotteryTextValidation.OnValidationComplete();
                        var intent = new Intent(this, typeof(MainActivity)).SetFlags(ActivityFlags.ReorderToFront);
                        SetResult(Result.Ok, intent);
                        Finish();
                    }
                });
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_scanner);
            cameraView = FindViewById <SurfaceView>(Resource.Id.surface_view);
            textView   = FindViewById <TextView>(Resource.Id.text_view);

            // null the static strings
            LotteryTextValidation.OnValidationComplete();

            TextRecognizer textRecog = new TextRecognizer.Builder(ApplicationContext).Build();

            if (!textRecog.IsOperational)
            {
                Log.Error("ReceiptLotteryScan activity", "depencecies are not activated");
            }
            else
            {
                cameraSource = new CameraSource.Builder(ApplicationContext, textRecog)
                               .SetFacing(CameraFacing.Back)
                               .SetRequestedPreviewSize(1280, 1024)
                               .SetRequestedFps(2.0f)
                               .SetAutoFocusEnabled(true)
                               .Build();

                cameraView.Holder.AddCallback(this);
                textRecog.SetProcessor(this);
            }
        }