DigitalInkRecognizer
Stay organized with collections
Save and categorize content based on your preferences.
Inherited Method Summary
From interface java.io.Closeable
From interface java.lang.AutoCloseable
Public Methods
public abstract void close ()
Frees all resources used by the recognizer. Calling any other method after this one
will result in an error.
Performs a recognition of the input ink using a recognition context.
A recognition context contains information about the size of the writing area, and
the characters that have already been entered. This helps disambiguate certain
cases.
Example usage: a previous recognition has yielded the string "hello", that has been
inserted in a text field. The user then handwrites "world". Send the present method the
ink showing "world", and "hello" as a string in `context`. The recognizer will most
likely return the string " world" with a leading space separating the two words.
See
RecognitionContext
for details.
Returns
- A list of recognition candidates. If nothing can be recognized, this list will be
empty.
Performs a recognition of the input ink using the default recognition context.
Using the default recognition context may lead to sub-optimal recognition
accuracy.
Parameters
ink |
Input to be recognized |
Returns
- A list of recognition candidates. If nothing can be recognized, this list will be
empty.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[],[],null,["# DigitalInkRecognizer\n\npublic interface **DigitalInkRecognizer** extends [Closeable](//developer.android.com/reference/java/io/Closeable.html), [LifecycleObserver](//developer.android.com/reference/androidx/lifecycle/LifecycleObserver.html) \nA [DigitalInkRecognition](/android/reference/com/google/mlkit/vision/digitalink/recognition/DigitalInkRecognition) client to perform recognition on digital ink.\n\nDigital ink is the vector representation of what a user has written. It is composed of a\nsequence of strokes, each being a sequence of touch points (coordinates and timestamp). See\n[Ink](/android/reference/com/google/mlkit/vision/digitalink/recognition/Ink)\nfor details.\n\nA [DigitalInkRecognizer](/android/reference/com/google/mlkit/vision/digitalink/recognition/DigitalInkRecognizer) is created via [DigitalInkRecognition.getClient(DigitalInkRecognizerOptions)](/android/reference/com/google/mlkit/vision/digitalink/recognition/DigitalInkRecognition#getClient(com.google.mlkit.vision.digitalink.recognition.DigitalInkRecognizerOptions)).\n\nExample: \n\n DigitalInkRecognizer recognizer = DigitalInkRecognition.getClient(options);\n \nThis class can be used from any thread. \n\n### Public Method Summary\n\n|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [close](/android/reference/com/google/mlkit/vision/digitalink/recognition/DigitalInkRecognizer#close())() Frees all resources used by the recognizer. |\n| abstract Task\\\u003c[RecognitionResult](/android/reference/com/google/mlkit/vision/digitalink/common/RecognitionResult)\\\u003e | [recognize](/android/reference/com/google/mlkit/vision/digitalink/recognition/DigitalInkRecognizer#recognize(com.google.mlkit.vision.digitalink.recognition.Ink,%20com.google.mlkit.vision.digitalink.recognition.RecognitionContext))([Ink](/android/reference/com/google/mlkit/vision/digitalink/recognition/Ink) ink, [RecognitionContext](/android/reference/com/google/mlkit/vision/digitalink/recognition/RecognitionContext) context) Performs a recognition of the input ink using a recognition context. |\n| abstract Task\\\u003c[RecognitionResult](/android/reference/com/google/mlkit/vision/digitalink/common/RecognitionResult)\\\u003e | [recognize](/android/reference/com/google/mlkit/vision/digitalink/recognition/DigitalInkRecognizer#recognize(com.google.mlkit.vision.digitalink.recognition.Ink))([Ink](/android/reference/com/google/mlkit/vision/digitalink/recognition/Ink) ink) Performs a recognition of the input ink using the default recognition context. |\n\n### Inherited Method Summary\n\nFrom interface java.io.Closeable \n\n|---------------|---------|\n| abstract void | close() |\n\nFrom interface java.lang.AutoCloseable \n\n|---------------|---------|\n| abstract void | close() |\n\nPublic Methods\n--------------\n\n#### public abstract void **close** ()\n\nFrees all resources used by the recognizer. Calling any other method after this one\nwill result in an error. \n\n#### public abstract Task\\\u003c[RecognitionResult](/android/reference/com/google/mlkit/vision/digitalink/common/RecognitionResult)\\\u003e\n**recognize** ([Ink](/android/reference/com/google/mlkit/vision/digitalink/recognition/Ink) ink, [RecognitionContext](/android/reference/com/google/mlkit/vision/digitalink/recognition/RecognitionContext) context)\n\nPerforms a recognition of the input ink using a recognition context.\n\nA recognition context contains information about the size of the writing area, and\nthe characters that have already been entered. This helps disambiguate certain\ncases.\n\nExample usage: a previous recognition has yielded the string \"hello\", that has been\ninserted in a text field. The user then handwrites \"world\". Send the present method the\nink showing \"world\", and \"hello\" as a string in \\`context\\`. The recognizer will most\nlikely return the string \" world\" with a leading space separating the two words.\n\nSee [RecognitionContext](/android/reference/com/google/mlkit/vision/digitalink/recognition/RecognitionContext) for details. \n\n##### Parameters\n\n| ink | Input to be recognized |\n| context | See [RecognitionContext](/android/reference/com/google/mlkit/vision/digitalink/recognition/RecognitionContext) for details. |\n|---------|-----------------------------------------------------------------------------------------------------------------------------|\n\n##### Returns\n\n- A list of recognition candidates. If nothing can be recognized, this list will be empty. \n\n#### public abstract Task\\\u003c[RecognitionResult](/android/reference/com/google/mlkit/vision/digitalink/common/RecognitionResult)\\\u003e\n**recognize** ([Ink](/android/reference/com/google/mlkit/vision/digitalink/recognition/Ink) ink)\n\nPerforms a recognition of the input ink using the default recognition context.\n\nUsing the default recognition context may lead to sub-optimal recognition\naccuracy. \n\n##### Parameters\n\n| ink | Input to be recognized |\n|-----|------------------------|\n\n##### Returns\n\n- A list of recognition candidates. If nothing can be recognized, this list will be empty."]]