在创建InputMethodService时立即销毁它

时间:2015-05-06 09:28:01

标签: java android exception android-input-method android-securityexception

我有一个MyIP=$(curl http://api.ipify.org/?format=text) if [ "$MyIP" != "MYORYGINALIP" ] then echo "IPSEC VPN is Running - " $MyIP else echo "IPSEC VPN is Not Running - " $MyIP fi exit 0 的子类,只有当用户在我的应用程序中时才能创建它,所以如果用户通过Android语言设置启用它,键盘应立即停用并更改回默认键盘。我的子类是这样的:

InputMethodService

就像我在评论中写的那样,如果我试图从public class CustomIME extends InputMethodService { @Override public void onCreate() { super.onCreate(); // do onCreate() stuff and find current activity if(currentActivity != myActivity){ switchBackToDefaultKeyboard(defaultKeyboard); } } public void switchBackToDefaultKeyboard(IME ime) { try { switchInputMethod(ime.getId()); } catch (Exception e) { DebugLog.e("Switching failed"); // this always fails when called from onCreate() } } } 内切换键盘,InputMethodService.switchInputMethod()方法将始终抛出异常。

异常消息是:

onCreate()

0 个答案:

没有答案