Development Guide
7.
To use a correction for a misspelled word, invoke SpellCheckEngine.learnCorrection(). Use the
parameters new StringBuffer(text), new StringBuffer(correction), where text represents
the misspelled word, and correction represents the correct word.
_spellCheckEngine.learnCorrection(new StringBuffer(text), new StringBuffer
(correction));
8.
To perform spell check operations on a field, invoke SpellCheckUI.spellCheck(), with a field as a parameter.
_spellCheckUI.spellCheck(field);
9.
To accept a misspelled word as correctly spelled, invoke SpellCheckEngine.learnWord(), with the word to
learn as a parameter.
_spellCheckEngine.learnWord(new StringBuffer(word));
Listen for a spell check event
1.
Import the following classes:
• java.lang.StringBuffer
• net.rim.device.api.ui.UiApplication
• net.rim.device.api.ui.Field
2.
Import the following interfaces:
• net.rim.blackberry.api.spellcheck.SpellCheckUIListener
• net.rim.blackberry.api.spellcheck.SpellCheckEngine
3.
Create a method that returns the SpellCheckUIListener.LEARNING_ACCEPT constant when the
SpellCheckEngine learns a new word.
public int wordLearned(SpellCheckUI ui, StringBuffer word)
{
UiApplication.getUiApplication().invokeLater(new popUpRunner("Word
learned"));
return SpellCheckUIListener.LEARNING_ACCEPT;
}
4.
Create a method that returns the SpellCheckUIListener.LEARNING_ACCEPT constant when the
SpellCheckEngine learns a correction for a word.
public int wordCorrectionLearned(SpellCheckUI ui, StringBuffer word,
StringBuffer correction)
{
UiApplication.getUiApplication().invokeLater(new popUpRunner("Correction
learned"));
return SpellCheckUIListener.LEARNING_ACCEPT;
}
5.
Create a method that returns the SpellCheckUIListener.ACTION_OPEN_UI constant when the
SpellCheckEngine finds a misspelled word.
Spell check
43