如何获取默认InputMethod的InputMethodService?
我已经尝试this但我不知道如何通过InputMethodInfo获取InputMethodService:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
List<InputMethodInfo> mInputMethodProperties = imm.getEnabledInputMethodList();
final int N = mInputMethodProperties.size();
for (int i = 0; i < N; i++) {
InputMethodInfo imi = mInputMethodProperties.get(i);
if (imi.getId().equals(Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD))) {
//imi contains the information about the keyboard you are using
break;
}
}
我忽略了其他任何解决方案吗?
答案 0 :(得分:2)
如果通过说“get”你的意思是得到它的id,并且你想知道当前所选的id(选择为默认值),这就是:
String currentKeyboard = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
答案 1 :(得分:0)
你不能&#34;得到&#34; InputMethodService
,因为它运行的过程与您的过程不同。