需要在代码中能够切换到第三方输入法 InputMethodService.switchInputMethod(String id)这个方法在继承InputMethodService的类中调用的话报错说需要一个权限 但是那个权限是系统app才能使用的 在Activity中调用上面的那个方法报错空指针异常 应该是SetInputMethod中的那个token为空 还有什么方法能够切换输入法的啊 有没有做过类似功能的大神啊 困扰好久了报错信息java.lang.RuntimeException: Unable to create service com.example.android.softkeyboard.SoftKeyboard: java.lang.SecurityException: Using null token requires permission android.permission.WRITE_SECURE_SETTINGS@Override public void onCreate() { super.onCreate(); mWordSeparators = getResources().getString(R.string.word_separators); Log.i("TEST", "TEST"); this.switchInputMethod("com.example.android.softkeyboard/.SoftKeyboard"); Log.i("TEST", "after TEST"); }在继承InputMethodService的累的oncreat中调用switchInputMethod方法 结果报错以上信息
添加回答
举报
0/150
提交
取消