I understand the difference between focused, selected and pressed . But I do not understand the difference between hasFocus() and isFocused() . I checked the description, both descriptions say almost the same thing. Can anyone explain this to me?
hasFocus()
isFocused()
hasFocus() is different from isFocused() . hasFocus() == true means that the View or one of its descendants is focused. If you take a closer look, there is a chain of hasFocused Views until you reach the view that IsFocused.
hasFocus() == true
That should explain a little about it.
Sometimes views in Android are grouped together, and if one of the views in this group has focus, the hasFocus() method returns true , but only if the particular view that you mention in the code is focused, isFocused() is true .
true