Development Guide
Task
Hide the touch screen keyboard on a
new screen.
Spell check
You can use the items of the net.rim.blackberry.api.spellcheck package to add spell check functionality to
an application. The SpellCheckEngine interface lets an application check the spelling of UI field values and provides a
BlackBerry® device user with options for spelling corrections. The SpellCheckUI interface lets an application provide a UI
that allows a BlackBerry device user to resolve spell check issues by interacting with the SpellCheckEngine
implementation.
For more information about using the Spell Check API, see the SpellCheckDemo sample, included with the BlackBerry® Java®
Development Environment version 4.3.1.
Add spell check functionality
1.
Import the following classes:
• net.rim.blackberry.api.spellcheck.SpellCheckEngineFactory
• java.lang.StringBuffer
2.
Import the following interfaces:
• net.rim.blackberry.api.spellcheck.SpellCheckEngine
• net.rim.blackberry.api.spellcheck.SpellCheckUI
• net.rim.blackberry.api.spellcheck.SpellCheckUIListener
3.
Create variables for spell check objects.
SpellCheckEngine _spellCheckEngine;
SpellCheckUI _spellCheckUI;
4.
Invoke createSpellCheckUI().
_spellCheckUI = SpellCheckEngineFactory.createSpellCheckUI();
5.
To notifiy an application when a spell check event occurs, invoke addSpellCheckUIListener() with a
SpellCheckUIListener object as a parameter.
_spellCheckUI.addSpellCheckUIListener(new SpellCheckUIListener());
6.
To let an application spell check UI fields and suggest spelling corrections to a BlackBerry device user, obtain a
SpellCheckEngine object, invoke getSpellCheckEngine().
_spellCheckEngine = _spellCheckUI.getSpellCheckEngine();
42
Steps
Invoke VirtualKeyboard.setVisibility(int) using one of the
following constants as a parameter: VirtualKeyboard.HIDE or
VirtualKeyboard.HIDE_FORCE.
Spell check