EditText calls onFocusChanged three times, not once

I need to make a ListView that contains for each element a EditText . If EditText receives focus, I need to display a dialog - this condition is strictly for when EditText receives focus, and not when pressed, because it can be selected even if it is not pressed ...

To do this, I use the focus listener on EditText , but onFocusChanged gets three times instead of three times instead of clicking the EditText button, this means that the dialog is called twice ...

This is the sequence of calls:

  • Has focus
  • Lost focus
  • Has focus

I have no other special handling of ListView or EditText .. so it must be out of the system in some way, maybe because I use EditText in ListView, which is a focused View too ..

Does anyone have any idea why this is happening and how I can β€œfix” it?

Thanks in advance.

+6
source share

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


All Articles