public class SpenRecognizer extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SpenRecognizer.RecognizerType
Recognizer type
|
static interface |
SpenRecognizer.ResultListener
This listener interface provides callback methods for getting recognition results.
Register this listener to get results for the request(ResultListener) method. |
| Modifier and Type | Method and Description |
|---|---|
void |
addStroke(SpenObjectStroke stroke)
Add a stroke
|
void |
cancel()
Cancel the recognition
It the api returns immediately, but engines might be being released internally. |
void |
clearStrokes()
Clear strokes
|
void |
close()
Close SpenRecognizer with removing memory
|
float[] |
getDisplayMetrics()
Get display metric information set to recognizer
|
String |
getLanguage()
Get current language set to recognizer
|
SpenRecognizer.RecognizerType |
getRecognizerType()
Get the current recognizer type
|
static String[] |
getSupportedLanguage(Context context)
Retrieve the supported languages in the device
|
SpenRecognizerResultContainerInterface |
recognize()
Recognize input strokes by
addStroke(SpenObjectStroke) method. |
void |
request(SpenRecognizer.ResultListener listener)
Recognize input strokes by
addStroke(SpenObjectStroke) method. |
void |
setDisplayMetrics(float xdpi,
float ydpi)
Set device display metrics obtained from
Resources.getDisplayMetrics() |
void |
setLanguage(String language)
Set language to the recognizer
|
void |
setRecognizerType(SpenRecognizer.RecognizerType type)
Set the recognizer type
|
public void setRecognizerType(SpenRecognizer.RecognizerType type)
type - type of recognizer SpenRecognizer.RecognizerTypeIllegalStateException - Thrown if the plug-in object is not loadedpublic SpenRecognizer.RecognizerType getRecognizerType()
IllegalStateException - Thrown if the plug-in object is not loadedpublic static String[] getSupportedLanguage(Context context)
context - application contextpublic void setLanguage(String language)
language - language codeIllegalStateException - Thrown if the plug-in object is not loadedIllegalArgumentException - Thrown if the language code is not supportedpublic String getLanguage()
IllegalStateException - Thrown if the plug-in object is not loadedpublic void addStroke(SpenObjectStroke stroke)
stroke - a handwriting stroke that you want to recognize.IllegalStateException - Thrown if the plug-in object is not loadedInvalidParameterException - Thrown if the stroke is emptypublic void clearStrokes()
IllegalStateException - Thrown if the plug-in object is not loadedpublic SpenRecognizerResultContainerInterface recognize()
addStroke(SpenObjectStroke) method. IllegalStateException - Thrown if the plug-in object is not loadedpublic void request(SpenRecognizer.ResultListener listener)
addStroke(SpenObjectStroke) method. listener - the recognizer result listener SpenRecognizer.ResultListenerIllegalStateException - Thrown if the plug-in object is not loadedpublic void cancel()
IllegalStateException - Thrown if the plug-in object is not loadedpublic void setDisplayMetrics(float xdpi,
float ydpi)
Resources.getDisplayMetrics()xdpi - physical pixels per inch of the screen in the X dimensionydpi - physical pixels per inch of the screen in the Y dimensionIllegalStateException - Thrown if the plug-in object is not loadedpublic float[] getDisplayMetrics()
public void close()