如何将键盘语言添加到Android Things 1.0.15

问题描述

我需要在Android Things版本1.0.15中向AOSP键盘添加语言。

当我尝试按空格键旁边的长按钮(“,”)修改语言时,应用程序崩溃:

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.INPUT_METHOD_SUBTYPE_SETTINGS flg=0x14200000 (has extras) }

我尝试安装其他键盘,例如gboard或swiftkey,但均未成功。我无法启动这些应用。

您知道其他解决方法吗?

解决方法

我解决了安装Gboard的问题,然后使用以下代码以编程方式选择了键盘:

    InputMethodManager inputMethodManager = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.showInputMethodPicker();