2016-04-24 7 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

ありがとう、仲間!あなたの答えをupvoteするためにStackOverflowにログインしました。ありがとう、トン! – ArhatBaid

+0

@CodeToLifeありがとうございました... –

関連する問題