Android: EditText loses focus when setText is called

I am creating an Android application that contains a timer that counts and displays in EditTexts. There is another EditText on the page that I would like to edit while the timer counts down.

The problem is that when I call setText () to update the timer text, another EditText loses focus. As the timer is updated every second, the soft keyboard fades in less than a second. Is there any way to prevent this?

I want the timer to work (on the screen) while the keyboard is visible, but I cannot find any good answers on how to do this.

Any help is appreciated!

+4
source share
1 answer

I had the same problem and editText.getText().clear() helped

+2
source

Source: https://habr.com/ru/post/1500052/


All Articles