How can I tell if the input method picker is open or closed?

前端 未结 3 1903
孤城傲影
孤城傲影 2020-12-18 22:12

My app opens the input method picker (the menu where you choose a keyboard) with InputMethodManager.showInputMethodPicker(). My app doesn\'t actually create the

3条回答
  •  佛祖请我去吃肉
    2020-12-18 23:15

    Simple you can know by using buildin function:

     @Override
            public void onWindowFocusChanged(boolean hasFocus) {
                super.onWindowFocusChanged(hasFocus);
                isMyInputMethodEnabled();// write what ever you want to do after default keyboard selected
            }
    
    
      public void isMyInputMethodEnabled() {
            String imId = Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
            if (imId.contains(getPackageName())) {
                startActivity(new Intent(this, Main_uk.class));
                finish();
            }
        }
    

提交回复
热议问题