Bibaswann Bandyopadhyay Bibaswann Bandyopadhyay - 5 months ago 86
Java Question

What is the difference between hasFocus() and isFocused() in android?

I understand the difference among focused, selected and pressed. But I don't understand the difference between

hasFocus()
and
isFocused()
. I checked the description, both descriptions say almost the same thing. Can anyone please explain this to me?

Answer

hasFocus() is different from isFocused(). hasFocus() == true means that the View or one of its descendants is focused. If you look closely, there's a chain of hasFocused Views till you reach the View that isFocused.