Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Spelling checker

You can use the items in the net.rim.blackberry.api.spellcheck package to add spelling checker functionality to an application. The SpellCheckEngine interface enables an application to check the spelling of a UI field value and provide a BlackBerry device user with options for spelling corrections. The SpellCheckUI interface enables an application to provide a UI that allows a BlackBerry device user to resolve a spelling issue- by interacting with the SpellCheckEngine implementation.

For more information about using the Spell Check API, see the Spell Check sample application, which is provided with BlackBerry Java Development Environment 4.3.1 or later, and with the BlackBerry Java Plug-in for Eclipse.

Add spell check functionality

Import the following classes:

net.rim.blackberry.api.spellcheck.SpellCheckEngineFactory

java.lang.StringBuffer

Import the following interfaces:

net.rim.blackberry.api.spellcheck.SpellCheckEngine

net.rim.blackberry.api.spellcheck.SpellCheckUI

net.rim.blackberry.api.spellcheck.SpellCheckUIListener

Create variables for spell check objects.

SpellCheckEngine _spellCheckEngine;
SpellCheckUI _spellCheckUI;

Invoke createSpellCheckUI().

_spellCheckUI = SpellCheckEngineFactory.createSpellCheckUI();

To notifiy an application when a spell check event occurs, invoke addSpellCheckUIListener() with a SpellCheckUIListener object as a parameter.

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.