Click or drag to resize
ISingleCharWidgetApi Methods

The ISingleCharWidgetApi type exposes the following members.

Methods
  NameDescription
Public methodAddSearchDir
Add given directory to handwriting resources search path. Directory name can point to a folder in the file system, or to a directory in a zip file. Handwriting resources can be loaded directly from the assets folder of an apk file, as shown below.
            widget.AddSearchDir("zip://" + getContext().getPackageCodePath() + "!/assets/conf/text");
            
Public methodAddStroke
Add a stroke to the widget.
Public methodCharacterCandidates
Return alternate candidate info for the character at specified index. This method computes the character range of the character at specified index, and provides alternate candidates.

Alternate candidates can be selected by calling the ReplaceCharacters(Int32, Int32, String) method with parameters from the candidate information object.

Public methodClear
Clear ink and text contained in the widget.
Public methodClearSearchPath
Clear handwriting resources search path.
Public methodCommit
Commit the current writing session, optionally clear ink from the screen. This method commits the current writing session if not empty and starts a new one. If the current writing session is empty, the widget does not start a new one.

The meaning of a writing session depends on the current handwriting recognition mode.

  • In superimposed mode, a writing session represents any kind of text (from a single character up to several sentences) with each character written on top of the other. A commit operation freezes all strokes and text interpretation, keeps them and starts a new writing session.
  • In isolated mode, a writing session represents a single character. A commit operation indicates the end of the current character and starts the next one.
  • In cursive mode, a writing session is a single screen page, which represents from a single character up to several words and sentences, laid out on a single or multiple lines. A commit operation indicates the end of the current screen page and starts the next one.

Strokes currently displayed on the screen are either kept or removed from the screen based on the value of the

clearInk
parameter.
Public methodConfigure
Configure handwriting recognition engine. This method is non-blocking and returns immediately.

Configuration is a lengthy process that may take up to several seconds, depending on the handwriting resources to be configured. It is recommended to setup a configuration listener to detect the end of the configuration process.

When the device is rotated, Android completely recreates the UI without restarting the process of the application. After the device has been rotated, you need to configure the new instance of ISingleCharWidgetApi by calling this method again.

Public methodDisableGesture
Disable detection of the specified gesture.
Public methodEnableGesture
Enable detection of the specified gesture.
Public methodGetUserLexicon
Return user lexicon (array of words).
Public methodInsertString
Insert the given string at the insertion point. This method inserts the given string into the input stream of the handwriting recognizer without freezing strokes. This method is particularly useful when implementing space or any other button.
Public methodIsGestureEnabled
Return whether specified gesture is enabled.
Public methodPenAbort
Simulate a pen abort event.
Public methodPenDown
Simulate a pen down event. This simulates a user that starts writing.
Public methodPenMove
Simulate a pen move event. This simulates a user writing.
Public methodPenUp
Simulate a pen up event. This simulates a user that ends writing.
Public methodReplaceCharacters
Replace characters in the text. This method can be used to select an alternate handwriting recognition candidate for any word or character. The specified character range shall span a word or a single character, and the provided replacement text shall be one of the possible candidates to trigger a word or character candidate change.

Characters may be inserted at any location in the text by calling this method with the same start and end character indices and a non-empty replacement string.

Characters may be deleted from the text by calling this method with a non-empty characters range and an empty or

null
replacement string.
Public methodSetOnBackspaceGestureListener
Register a callback to invoke when a backspace gesture is detected.
Public methodSetOnConfiguredListener
Register a callback to invoke when configuration ends.
Public methodSetOnLongPressGestureListener
Register a callback to invoke when a long press gesture is detected.
Public methodSetOnPenAbortListener
Register a callback to invoke when user aborts writing.
Public methodSetOnPenDownListener
Register a callback to invoke when user starts writing.
Public methodSetOnPenMoveListener
Register a callback to invoke when user is writing.
Public methodSetOnPenUpListener
Register a callback to invoke when user ends writing.
Public methodSetOnReturnGestureListener
Register a callback to invoke when a return gesture is detected.
Public methodSetOnSingleTapGestureListener
Register a callback to invoke when a single tap gesture is detected.
Public methodSetOnTextChangedListener
Register a callback to invoke when the text changes.
Public methodSetUserLexicon
Set user lexicon (array of words).
Public methodWordCandidates
Return alternate candidate info for the word at specified index. This method computes the character range of the word at specified index, and provides alternate candidates and possible completions.

Alternate candidates can be selected by calling the ReplaceCharacters(Int32, Int32, String) method with parameters from the candidate information object.

Top
See Also