How can I change keyboard layout programmatically?

Hello.
How can I change keyboard layout programmatically?
I tried with this code:

inputContext.selectInputMethod(Locale.ENGLISH);

Thanks.

May I ask what’s your use case? I’m not entirely certain what you are trying to accomplish.

Hi,

If I understood correctly, you would like to change the keyboard layout programaticaly from the app itself? I am not certain if a browser would allow a web application to change the users keyboard layout (which is managed by the OS). However, here is a nice discussion on whether such functionality is a good:
https://ux.stackexchange.com/questions/48130/is-it-good-to-change-keyboards-input-language-automatically-in-javascript

  • Goran