Android custom Keyboard issues with edittext max length

580 views Asked by At

I have been facing an issue for quite some time now and could not find a solution for it, hence approaching StackOverflow.

I have developed a Custom keyboard. All the functionalities are working well except for one small glitch.

I have developed a test app to test the custom keyboard in which for an EditText, have given the maxlength property (Assume maxlength as 10). When we are trying to type in that EditText the text shown in the EditText only for 10 chars as expected. If we continue typing even after the 10 chars it is not displayed in the UI but suggestions are shown and also when we use backspace it won't clear the visible character in the EditText, instead first it clears the extra chars that are input and then once the length is 10 it will start to remove the visible characters.

As the code is too big to post here I am updating the screen shots of the issue so that it would be easy to understand.

enter image description here enter image description here

I have searched regarding this but always getting answers to add max length to edit text, which is not in my control.

I am thinking if we can get the maxlength property of the current focused edittext in the keyboard, we can overcome this issue.

1) Is my above assumption a valid one

2) If yes, is there a way to get the current focused edittext property in my input service?

Any inputs will be appreciated. Thanks in advance.

0

There are 0 answers