KMManager.setKeyboard()
Summary
The setKeyboard()
method sets the keyboard to be used.
Syntax
KMManager.setKeyboard(Context context, Keyboard keyboardInfo)
Parameters
context
- The context.
keyboardInfo
- Keyboard type of the keyboard information.
Returns
Returns true
if the keyboard was set successfully, false
otherwise.
Description
Use this syntax to set a keyboard which has already been added into the keyboards list.
Syntax
KMManager.setKeyboard(String packageID, String keyboardID, String languageID)
Parameters
packageID
- ID of the keyboard package.
keyboardID
- ID of the keyboard.
languageID
- ID of the associated language.
Returns
Returns true
if the keyboard was set successfully, false
otherwise.
Description
Use this syntax to set a keyboard which has already been added into the keyboards list.
Syntax
KMManager.setKeyboard(String packageID, String keyboardID, String languageID, String keyboardName, String languageName, String kFont, String kOskFont)
Parameters
packageID
- ID of the keyboard package.
keyboardID
- ID of the keyboard.
languageID
- ID of the associated language.
keyboardName
- Name of the keyboard.
languageName
- Name of the associated language.
kFont
- Filename or description of the font to type with the keyboard. Can be
null
or empty string. kOskFont
- Filename or description of the font displayed on the keyboard. Can be
null
or empty string.
Returns
Returns true
if the keyboard was set successfully, false
otherwise.
Description
Use this syntax to set a keyboard which has already been added into the keyboards list.
Syntax
KMManager.setKeyboard(Context context, int position)
Parameters
context
- The context.
position
- 0-based position of the keyboard in the keyboards list.
Returns
Returns true
if the keyboard was set successfully, false
otherwise.
Description
Use this syntax to set a keyboard which has already been added into the keyboards list.
Examples
Example 1: Using setKeyboard()
The following script illustrate the use of setKeyboard()
with keyboard information:
// Setting a Keyman keyboard
Keyboard keyboardInfo = KMManager.getDefaultKeyboard();
KMManager.setKeyboard(getApplicationContext(), keyboardInfo);
Example 2: Using setKeyboard()
The following script illustrate the use of setKeyboard()
with package ID, keyboard ID, and language ID:
// Setting a Keyman keyboard
KMManager.setKeyboard("sil_euro_latin", "sil_euro_latin", "en");
Example 3: Using setKeyboard()
The following script illustrate the use of setKeyboard()
:
// Setting a custom keyboard from the tamil99m keyboard package
KMManager.setKeyboard("tamil99m", "tamil99m", "ta", "Tamil 99M", "Tamil", "aava1.ttf", "aava1.ttf");
Example 4: Using setKeyboard()
The following script illustrate the use of setKeyboard()
with keyboard index:
// Setting a custom keyboard which exists in keyboards list
int kbIndex = KMManager.getKeyboardIndex(this, "tamil99m", "ta");
KMManager.setKeyboard(this, kbIndex);