Practially I want to develop a keyboard for my local language,and after studying the developers document on IME and playing with the sample app for Softkeyboard I came to conclusion that the qwerty xml file contains the keycodes that are sent to the input field. But the keycodes are allowed to be only ASCII character but mine local language is unicode character for more specific its a Devanagiri font . And so please can any one show me the way to do this from here. I thought of using switch case for each ASCII code and send respective Devanagiri I wish to the input field by committing text "क" for a ASCII code of q, but I don't think is the good Idea. Please if anyone have good idea.
My proposal for implementing this idea is as:
private void handleCharacter(int primaryCode, int[] keyCodes) {
Log.v("*************","primary code is:"+primaryCode);
if (isInputViewShown()) {
if (mInputView.isShifted()) {
primaryCode = Character.toUpperCase(primaryCode);
}
}
if (isAlphabet(primaryCode) && mPredictionOn) {
switch (primaryCode){
case 113:
mComposing.append("क");
getCurrentInputConnection().setComposingText(mComposing,1);
updateShiftKeyState(getCurrentInputEditorInfo());
updateCandidates();
break;
default:
mComposing.append((char) primaryCode);
getCurrentInputConnection().setComposingText(mComposing, 1);
updateShiftKeyState(getCurrentInputEditorInfo());
updateCandidates();
}
} else {
//changes made here
getCurrentInputConnection().commitText(
String.valueOf((char) primaryCode), 1);
//getCurrentInputConnection().commitText("क",1);
}
}
But this method doesn't look appropriate so please can i get some guidelines.