Text Capture Listener#

Defined in library scandit_datacapture_text

abstract class TextCaptureListener

Added in version 6.11.0

Listener interface for traditional text capture.

didCaptureText(textCapture, session)#
void didCaptureText(TextCapture textCapture,
        TextCaptureSession session)

Added in version 6.11.0

Invoked whenever at least one text has been captured. The newly captured texts can be retrieved from TextCaptureSession.newlyCapturedTexts.

This method is invoked from a recognition internal thread. To perform UI work, you must dispatch to the main thread first.

Inside this method, you will typically want to start processing the captured texts somehow, e.g. by validating the text captured. Depending on the application, you will want to pause, or stop recognition, or continue reading texts:

  • To pause the capture session, but keep the camera (frame source) running, just set the text capture‚Äôs enabled property to false.

    textCapture.isEnabled = false;
  • To stop the capture session, you will need to both disable the capture mode and stop the frame source. While it is possible to only stop the camera and keep the capture mode enabled, this may lead to additional capture events being delivered, which is typically not desired. The following lines of code show how to disable the capture mode and stop the frame source as well:

    // no more didCaptureText callbacks will be invoked after this call
    textCapture.isEnabled = false;
    // turn off the camera