How to programmatically get current keyboard language on an Android device

前端 未结 2 1641
夕颜
夕颜 2020-12-10 17:35

I am writing an application which is using dictionaries. I want to switch between dictionaries any time user change input language. For example if the typing language is eng

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-10 18:15

    InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    
    InputMethodSubtype ims = imm.getCurrentInputMethodSubtype();
    
    String locale = ims.getLocale();
    

    You can try this code to get Current Keyboard Language regional code.

提交回复
热议问题