Stay organized with collections
Save and categorize content based on your preferences.
View.OnFocusChangeListener
public
static
interface
View.OnFocusChangeListener
android.view.View.OnFocusChangeListener
|
Known indirect subclasses
|
Interface definition for a callback to be invoked when the focus state of
a view changed.
Summary
Public methods |
abstract
void
|
onFocusChange(View v, boolean hasFocus)
Called when the focus state of a view has changed.
|
Public methods
onFocusChange
public abstract void onFocusChange (View v,
boolean hasFocus)
Called when the focus state of a view has changed.
Parameters |
v |
View : The view whose state has changed. |
hasFocus |
boolean : The new focus state of v. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# View.OnFocusChangeListener\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \n\nView.OnFocusChangeListener\n==========================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/view/View.OnFocusChangeListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nView.OnFocusChangeListener\n`\n\n\n`\n\n\n`\n\n|-----------------------------------------|\n| android.view.View.OnFocusChangeListener |\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [TabWidget](/reference/android/widget/TabWidget) |--------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [TabWidget](/reference/android/widget/TabWidget) | *This class was deprecated in API level 30. new applications should use fragment APIs instead of this class: Use [TabLayout and ViewPager](/guide/navigation/navigation-swipe-view) instead.* | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface definition for a callback to be invoked when the focus state of\na view changed.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onFocusChange](/reference/android/view/View.OnFocusChangeListener#onFocusChange(android.view.View,%20boolean))`(`[View](/reference/android/view/View)` v, boolean hasFocus) ` Called when the focus state of a view has changed. |\n\nPublic methods\n--------------\n\n### onFocusChange\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onFocusChange (View v, \n boolean hasFocus)\n```\n\nCalled when the focus state of a view has changed.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|--------------------------------------------------|\n| `v` | `View`: The view whose state has changed. \u003cbr /\u003e |\n| `hasFocus` | `boolean`: The new focus state of v. \u003cbr /\u003e |"]]