Search code examples
androidkeyboardcustom-keyboard

How to set dynamic text to edit text from the custom keyboard


I want to set dynamic text to my edit text from the custom keyboard.

For example if I press "a" from the my keyboard then I want to set clipboard data to my edit text.

I use following demo for custom keyboard,

    https://github.com/blackcj/AndroidCustomKeyboard

And it work perfect, but I want to just customize it, I want to override my functionality on it, if I am press any of alphabet then I want to perform my action on application edit text.

Please suggest how to do this , and this is possible to paste my clip board data to edittext from the my custom keyboard any key event?


Solution

  • You should have call back method for each key pressed by user, so you can set your custom test to edit text. You must have class that extends InputMethodService which overrides onKeyDown method where you can write code to set custom text to edit text based on key pressed by user.