Google keyboard not working for keylistener in android studio

445 Views Asked by At

I want to add a functionality on click of "enter" key of Google's keyboard without vanquishing the default newline characteristic. I have used OnKeyListener but it is not working. The same code is working with other keyboards.

1

There are 1 best solutions below

2
On

SOft keyboards don't send key events, only hardware keys do. They use the input connection and send commit() calls. Your best choice, assuming they keyboard is connected to an EditView, is to use a TextWatcher. If the keyboard is connected to some other view, you'll need to override onCreateInputConnection and hook commit.