2016-04-24 93 views

回答

2

原来我只是不得不这样做:

InputMethodManager im = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); 
    String list = im.getEnabledInputMethodList().toString(); 
    if(list.contains(<MY KEYBOARD ID>)){ 
    //Do something 
    } 
6

检查下面的代码: -

String packageLocal = getPackageName(); 
    boolean isInputDeviceEnabled = false; 
    InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); 
    List<InputMethodInfo> list = inputMethodManager.getEnabledInputMethodList(); 

    // check if our keyboard is enabled as input method 
    for (InputMethodInfo inputMethod : list) { 
     String packageName = inputMethod.getPackageName(); 
     if (packageName.equals(packageLocal)) { 
      Toast.makeText(getApplicationContext(),"Your Keyboard Enable",Toast.LENGTH_SHORT).show(); 
     } 
    } 
+1

我者优先这个答案,因为它是sillyly简单,只需要复制过去的项目! – CodeToLife

+0

谢谢,兄弟!我登录到StackOverflow只是为了满足你的答案。万分感谢!!! – ArhatBaid

+0

@CodeToLife谢谢先生... –

相关问题