12

I have a weird behavior on my xubuntu machine and I don't know why.

  1. Start the emulator and have a EditText in the app.
  2. Tap on EditText and the android keyboard pops up
  3. Tap keys on my PC's hardware keyboard but no input on the emulator.
  4. Now here is the weird part, tap on the 3 dots menu of the emulator settings: enter image description here

  5. The settings screen opens, for instance with the Locations setting which does have an input field for Longitude. I close the screen

  6. Now the input of my PC's keyboard works on the emulator.

So, basically only after doing these steps I can input in the emulator using my keyboard. If I go back to Android Studio and type something, when I return to the emulator, it does not work. How can I make the input work all the time?

Alin
  • 14,809
  • 40
  • 129
  • 218

4 Answers4

23

You see, the main case is Android Emulator Window don't have the proper focus even when you click on it. Yes, you can do any touch-operations, but frame still appears non-focused.

I've found a workaround for that:

  1. Go to your Window Manager
  2. Find Focus tab
  3. Change Focus Model -> "Focus follow mouse"
  4. (Optional) Apply proper delay (I've put it to the lowest value)
  5. Disable "Automatically raise windows when they receive focus" option bellow.

Now, whenever you hang your cursor above the emulator window it'll gain correct focusing state and you'd be able to use you keyboard just fine.

Paul Freez
  • 1,059
  • 15
  • 27
  • 2
    Wow, that was unexpected. Thanks a lot for your answer – Alin Mar 10 '17 at 14:41
  • Not work with `Xubuntu 17.10` + `Pixel 2 API 27 Google API x86 Image Rev. 4 emulator` + `VirtualScene` when using `arcore`. – imknown Mar 02 '18 at 04:55
  • This solution is tested and works like a charm! Debian 9.8 & Xfce 4.12 – csonuryilmaz Mar 14 '19 at 08:31
  • Another workaround is clicking the mouse wheel inside the emulator to acquire focus (in my case, I don't like the "focus follow mouse" option) – pdpino May 15 '20 at 22:23
9

If you open the Window Manager Tweaks menu and go to Focus tab then you can select the Do nothing option under the When a window raises itself. This worked for me multiple times. (Different ubuntu verions)

f.david314
  • 91
  • 1
  • 1
  • Amazing! It worked! I've been suffering from this for a long time, and even filed a bug report with Google (who say that "XFCE is unofficial and unsupported"). Now with "When a window raises itself" -> "Do nothing" is just works, every time. Fedora 28, XFWM4 version 4.12.5. – Kostya Vasilyev Oct 11 '18 at 09:39
  • Thanks, I 've tested the suggested solution and it works! Configuration: Debian 9.4 x86_64 GNU/Linux || Xfce 4.12 || AVD Emulator 27.3.10.0 – csonuryilmaz Oct 17 '18 at 00:10
  • 1
    It works for me as well! It seems the "Activate focus stealing prevention" option also needs to be checked. Using Xubuntu 18.04, Xfce 4.12, AVD Emulator 28.0.23.0 – nitroglycerine Apr 15 '19 at 07:06
4

Mine was caused because I was using a keyboard layout different from English US (I could notice strange symbols when I typed in the emulator settings screen - the three dots as OP pointed out). After I changed my keyboard layout the problem is gone.

Strange symbols when the wrong keyboard layout is used

3

On Ubuntu 18.04 and 19.04 this happens when you have multiple keyboard layouts installed on your system. Try to select your first keyboard layout from the list to make virtual keyboard work in emulator.

Strangely, it doesn't matter which particular layout you have selected, or if it matches with language in the emulator, but looks like it is related to the position of the keyboard layout in the list.

zub0r
  • 1,299
  • 1
  • 14
  • 20