# FragmentStrictMode.OnViolationListener

Artifact: [androidx.fragment:fragment](https://developer.android.com/jetpack/androidx/releases/fragment) [View Source](https://cs.android.com/search?q=file:androidx/fragment/app/strictmode/FragmentStrictMode.kt+class:androidx.fragment.app.strictmode.FragmentStrictMode.OnViolationListener) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.4.0)

*** ** * ** ***


```
public fun interface FragmentStrictMode.OnViolationListener
```

<br />

*** ** * ** ***

When `https://developer.android.com/reference/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#penaltyListener(androidx.fragment.app.strictmode.FragmentStrictMode.OnViolationListener)` is enabled, the listener is called when a violation occurs.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/fragment/app/strictmode/FragmentStrictMode.OnViolationListener#onViolation(androidx.fragment.app.strictmode.Violation)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/strictmode/Violation violation)` Called on a policy violation. |

## Public methods

### onViolation

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.4.0)

```
abstract void onViolation(@NonNull Violation violation)
```

Called on a policy violation.