How to show soft keyboard on Android Things?
Asked Answered
M

2

7

I'm trying to show soft keyboard on Android Things, Raspberry Pi 3. I tried the methods below, but not succeeded so far:

<activity
       ...
       android:windowSoftInputMode="stateAlwaysVisible">

and

<EditText
        ...
        android:inputType="numberDecimal"/>

Does Android Things 7.0 support soft keyboard, or am I missing something?

Marxismleninism answered 3/2, 2017 at 1:17 Comment(0)
S
3

Update II: there is a bug with Dev Preview 5.1 when Google's soft keyboard doesn't show up at all.

Update: starting with Dev Preview 4 the Android Things image is shipped with com.google.android.inputmethod.latin preinstalled. If you're going to use a 3d party keyboard app the approach below is still valid.


You should enable the IME in Android Things Developer Preview in order for it to show up. Let's consider Google Keyboard as an example (since it worked for you). Once the keyboard has been installed and you shell-ed in (with adb shell) the following options might be used:


Command line solution

  • Find out the IME ID

    $ ime list -a | grep mId
    
  • Enable the IME using the fully qualified mId

    Android Things 0.5+ (you might get already enabled)

    $ ime enable com.android.inputmethod.latin/.LatinIME
    

    Android Things 0.1 - 0.4:

    $ ime enable com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
    

Note: If you'd like to use the IME "app-wide" (not "system-wide"), use ime set ID instead of ime enable ID.


Settings app solution

Android Things 0.5+:

    am start -n com.android.settings/.Settings\$SystemDashboardActivity

Languages & Input -> Virtual keyboard -> Manage keyboards and enable the IME (should already be enabled)

Android Things 0.1 - 0.4:

    am start -n com.android.settings/.Settings\$InputMethodAndLanguageSettingsActivity

Virtual keyboard -> Manage keyboards and enable the IME

Note: In order to close _Android_'s settings app from within shell you can emulate a back button press multiple times with input keyevent 4 or force close the app with am force-stop com.android.settings.

Sorbian answered 3/2, 2017 at 22:12 Comment(6)
I tried AT0.5.1. Soft keyboard does not show up again in all cases described above.Marxismleninism
@Ibrahim ERTURK, the solutions are fine. It's a bug in AT 0.5.1Sorbian
None of this seems to work on 6.1 unfortunately... Does 6.1 require different steps? Or did it inherit the 5.1 bug?Crete
@Stefan Haustein, if you get the already enabled message when enabling the IME as per the answer, then I believe the bug has been inherited.Sorbian
Yes, get the "already enabled" answer. The bug is marked as fixed here though: issuetracker.google.com/issues/68768712Crete
@Stefan Haustein, good reference! It states: "Soft keyboard package added back in DP6", but the package had already been added in DP 5.(0/1) which was stated above. So yet I believe the bug has been inherited.Sorbian
C
2

By default, keybord apps are not installed on AT Developer Preview. You have to install it. See software keyboard.

Crescendo answered 3/2, 2017 at 10:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.