android - Change keyboard language programatically -


in application user selects language , want show selected language when keyboard opens (if present in keyboard options). keyboard provides option, should possible.

there big work around how - create own keyboard, , you'll have know keyboards you're aiming for. (which exact duplicate of regular keyboard)

general guide on subject here & code samples.

create custom keyboard view extends keyboardview
in create static key value variable like

static final int keycode_language_switch_eng = -102; static final int keycode_language_switch_urdu = -103; 

after in ime class have implemented inputmethodservice, create keyboards inside oninitializeinterface override function. like

msymbolskeyboard = new keyboard(this, r.xml.qwerty2); mengqwertykeyboard = new keyboard(this, r.xml.eng_qwerty); 

after add these final static keys in onkey override function switch cases, , in cases set keyboards accordingly:

setkeyboard(mengqwertykeyboard); 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -