Text Capture#

Defined in package com.scandit.datacapture.text.capture

TextCapture#
class TextCapture : DataCaptureMode

Added in version 6.1.0

Capture mode for reading text.

forDataCaptureContext(context, settings)#
static @NonNull TextCapture forDataCaptureContext(@Nullable DataCaptureContext context,
        @NonNull TextCaptureSettings settings)

Added in version 6.1.0

Construct a new text capture mode with the provided context and settings. Then the context is not null, the capture mode is automatically added to the context.

fromJson(context, jsonData)#
static @NonNull TextCapture fromJson(@NonNull DataCaptureContext context,
        @NonNull String jsonData)

Added in version 6.3.0

Construct a new text capture mode with the provided JSON serialization. See Serialization for details. The capture mode is automatically added to the context.

isEnabled#
boolean isEnabled()
void setEnabled(boolean value)

Added in version 6.1.0

Implemented from DataCaptureMode. See DataCaptureMode.isEnabled.

pointOfInterest#
@Nullable PointWithUnit getPointOfInterest()
void setPointOfInterest(@Nullable PointWithUnit value)

Added in version 6.1.0

The point of interest overwriting the point of interest of the data capture view. By default, this overwriting point of interest is not set and the one from the data capture view is used. The overwriting point of interest is used to control the center of attention for the following subsystems:

  • Location selection. When no location selection is set, the point of interest defines the location at which the recognition optimizes for reading barcodes.

  • Rendered viewfinders.

applySettings(settings, whenDone)#
void applySettings(@NonNull TextCaptureSettings settings, @Nullable Runnable whenDone)

Added in version 6.1.0

Asynchronously apply the new settings to the text capture mode. If text capture is currently running, the task will complete when the next frame is processed, and will use the new settings for that frame. If text capture is currently not running, the task will complete as soon as the settings have been stored and won’t wait until the next frame is going to be processed.

applySettings(settings)#
void applySettings(@NonNull TextCaptureSettings settings)

Added in version 6.1.0

Same as applySettings() with the second argument set to null.

feedback#
@NonNull TextCaptureFeedback getFeedback()
void setFeedback(@NonNull TextCaptureFeedback value)

Added in version 6.1.0

Instance of TextCaptureFeedback that is used by text capture to notify users about Success events.

The default instance of the Feedback will have both sound and vibration enabled. A default beep sound will be used for the sound.

To change the feedback emitted, the TextCaptureFeedback can be modified as shown below, or a new one can be assigned.

TextCapture textCapture = ...;
textCapture.getFeedback().setSuccess(new Feedback(null, Sound.defaultSound()));
addListener(listener)#
void addListener(@NonNull TextCaptureListener listener)

Added in version 6.1.0

Add the listener to observe this text capture instance.

In case the same listener is already observing this instance, calling this method will not add the listener again.

removeListener(listener)#
void removeListener(@NonNull TextCaptureListener listener)

Added in version 6.1.0

Remove a previously added listener from this text capture instance.

In case the listener is not currently observing this instance, calling this method has no effect.

createRecommendedCameraSettings()#
static @NonNull CameraSettings createRecommendedCameraSettings()

Added in version 6.1.0

Returns the recommended camera settings for use with text capture.

dataCaptureContext#
@Nullable DataCaptureContext getDataCaptureContext()

Added in version 6.1.0

Implemented from DataCaptureMode. See DataCaptureMode.dataCaptureContext.

updateFromJson(jsonData)#
void updateFromJson(@NonNull String jsonData)

Added in version 6.3.0

Updates the mode according to a JSON serialization. See Serialization for details.