Stay organized with collections
Save and categorize content based on your preferences.
ViewTreeObserver.OnGlobalFocusChangeListener
public
static
interface
ViewTreeObserver.OnGlobalFocusChangeListener
android.view.ViewTreeObserver.OnGlobalFocusChangeListener
|
Known indirect subclasses
WebView |
A View that displays web pages.
|
|
Interface definition for a callback to be invoked when the focus state within
the view tree changes.
Summary
Public methods |
abstract
void
|
onGlobalFocusChanged(View oldFocus, View newFocus)
Callback method to be invoked when the focus changes in the view tree.
|
Public methods
onGlobalFocusChanged
public abstract void onGlobalFocusChanged (View oldFocus,
View newFocus)
Callback method to be invoked when the focus changes in the view tree. When
the view tree transitions from touch mode to non-touch mode, oldFocus is null.
When the view tree transitions from non-touch mode to touch mode, newFocus is
null. When focus changes in non-touch mode (without transition from or to
touch mode) either oldFocus or newFocus can be null.
Parameters |
oldFocus |
View : The previously focused view, if any. |
newFocus |
View : The newly focused View, if any. |
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ViewTreeObserver.OnGlobalFocusChangeListener\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \n\nViewTreeObserver.OnGlobalFocusChangeListener\n============================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/view/ViewTreeObserver.OnGlobalFocusChangeListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nViewTreeObserver.OnGlobalFocusChangeListener\n`\n\n\n`\n\n\n`\n\n|-----------------------------------------------------------|\n| android.view.ViewTreeObserver.OnGlobalFocusChangeListener |\n\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [WebView](/reference/android/webkit/WebView) |----------------------------------------------|---------------------------------| | [WebView](/reference/android/webkit/WebView) | A View that displays web pages. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface definition for a callback to be invoked when the focus state within\nthe view tree changes.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onGlobalFocusChanged](/reference/android/view/ViewTreeObserver.OnGlobalFocusChangeListener#onGlobalFocusChanged(android.view.View,%20android.view.View))`(`[View](/reference/android/view/View)` oldFocus, `[View](/reference/android/view/View)` newFocus) ` Callback method to be invoked when the focus changes in the view tree. |\n\nPublic methods\n--------------\n\n### onGlobalFocusChanged\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onGlobalFocusChanged (View oldFocus, \n View newFocus)\n```\n\nCallback method to be invoked when the focus changes in the view tree. When\nthe view tree transitions from touch mode to non-touch mode, oldFocus is null.\nWhen the view tree transitions from non-touch mode to touch mode, newFocus is\nnull. When focus changes in non-touch mode (without transition from or to\ntouch mode) either oldFocus or newFocus can be null.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|-----------------------------------------------------|\n| `oldFocus` | `View`: The previously focused view, if any. \u003cbr /\u003e |\n| `newFocus` | `View`: The newly focused View, if any. \u003cbr /\u003e |"]]