我开发了一个短信发送者应用程序,我想知道用户使用的语言.因此,当用户键入消息时,我如何知道他/她使用的语言?
解决方法
通过使用获取输入类型管理器:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
然后,使用下面的方法选择从中获取的内容:
http://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html#getCurrentInputMethodSubtype%28%29
要么:
http://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html#getLastInputMethodSubtype()
与此一起获取输入类型的语言环境:
http://developer.android.com/reference/android/view/inputmethod/InputMethodSubtype.html#getLocale()