How To Add Switch Language Functionality In The Android Soft Keyboard?
The Android Soft Keyboard application currently has English language, and I am modifying it to add another language into it. I am almost done with layout of new language and adding
Solution 1:
I finally figured out the solution. I added the following code right after the above code (code in the question) to switch between languages:
elseif (primaryCode == 10000) {
Keyboardcurrent= mInputView.getKeyboard();
current = mQwertyNewKeyboard;
mInputView.setKeyboard(current);
//Switch to qwerty (English Main)
}elseif (primaryCode == 10001) {
Keyboardcurrent= mInputView.getKeyboard();
current = mQwertyKeyboard;
mInputView.setKeyboard(current);
//Switch to qwertyNewShift
}elseif (primaryCode == 10002) {
Keyboardcurrent= mInputView.getKeyboard();
current = mQwertyNewKeyboardShift;
mInputView.setKeyboard(current);
}
And in the layout (xml) file of each language, I created a switch button and set the primaryCode
accordingly.
<Key android:codes="10001" android:keyIcon="@drawable/sym_keyboard_language_switch" android:keyWidth="10%p"/>
Post a Comment for "How To Add Switch Language Functionality In The Android Soft Keyboard?"