问题描述
我正在尝试检测当前选择的键盘语言。为此,我使用以下代码:
代码
/* Return the handle to a system-level service by name. The class of the returned
* object varies by the requested name. */
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
/* Returns the current input method subtype. This subtype is one of the subtypes in the
* current input method. This method returns null when the current input method doesn't
* have any input method subtype. */
InputMethodSubtype ims = imm.getCurrentInputMethodSubtype();
/* The locale of the subtype. This method returns the "locale" string parameter passed
* to the constructor. */
String locale = ims.getLocale();
但应用程序在功能上遇到NoSuchMethodError
异常。getCurrentInputMethodSubtype
问题
有没有办法让键盘选择语言?如果没有,我如何检测用户在应用程序中输入的语言?