Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/view/View.OnFocusChangeListener#pubmethods)

# View.OnFocusChangeListener

*** ** * ** ***

` public static interface View.OnFocusChangeListener `   
` `

|---|
| android.view.View.OnFocusChangeListener |

Known indirect subclasses [TabWidget](https://developer.android.com/reference/android/widget/TabWidget) [TabWidget](https://developer.android.com/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](https://developer.android.com/guide/navigation/navigation-swipe-view) instead.*   

*** ** * ** ***

Interface definition for a callback to be invoked when the focus state of a view changed.

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/view/View.OnFocusChangeListener#onFocusChange(android.view.View,%20boolean)(https://developer.android.com/reference/android/view/View v, boolean hasFocus) ` Called when the focus state of a view has changed. |

## Public methods

### onFocusChange

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onFocusChange (View v, 
                boolean hasFocus)
```

Called when the focus state of a view has changed.

<br />

| Parameters ||
|---|---|
| `v` | `View`: The view whose state has changed. <br /> |
| `hasFocus` | `boolean`: The new focus state of v. <br /> |