I have an activity with a single TextView (tv1) and a button that, when clicked, displays a DialogFragment with another TextView tv2. tv1 has focus when the activity starts, and tv2 has focus when the DialogFragment is shown.
The trouble is that tv1 doesn't seem to lose focus-- its onFocusChangedListener is never called. Is there some other signal I can use to indicate that tv1 no longer actually has focus? (note that monitoring tv2 is not a good solution here-- I have several other ways that dialogs may gain focus)
You may very well override the onWindowFocusChanged()
callback method of your activity since showing a Dialog results in the activity itself losing its focus. The mentioned method could be the signal that the TextView (tv1
) has lost its focus.