M
M
mopsicus2016-12-22 10:42:21
Java
mopsicus, 2016-12-22 10:42:21

How to catch "non-Latin" characters in android?

It is necessary to catch all pressing on the keyboard of the device. I show it programmatically with

...
      if (view != null) {
            InputMethodManager imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(view, 0);
        }
...

I put the handler
.....
        view.setOnKeyListener(new View.OnKeyListener() {
            @Override
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                int keyunicode = event.getUnicodeChar(event.getMetaState() );
                char character = (char) keyunicode;
                Log.i("KEYBOARD",  character);
                ......
                return true;
            }
        });

Latin letters, numbers, etc. are intercepted, but when I switch to the Russian keyboard, the event is not even called, I suspect that this will also be the case in other languages. How to make it intercept everything from the keyboard?
Thanks

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question