How to detect hardware keyboard presence?

后端 未结 3 956
梦谈多话
梦谈多话 2020-12-24 03:30

Is there a way to detect if the device I\'m currently running on has a hardware keyboard installed?

How do I query device capabilities anyway?

3条回答
  •  有刺的猬
    2020-12-24 04:05

    To detect common qwerty keyboard connected use this:

    private boolean isKeyboardConnected() {
        return getResources().getConfiguration().keyboard == KEYBOARD_QWERTY;
    }
    

提交回复
热议问题