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

# StrictMode.OnThreadViolationListener

*** ** * ** ***


`
public
static


interface
StrictMode.OnThreadViolationListener
`


`


`

|---|
| android.os.StrictMode.OnThreadViolationListener |

<br />

*** ** * ** ***

When #`https://developer.android.com/reference/android/os/StrictMode.ThreadPolicy.Builder#penaltyListener(java.util.concurrent.Executor,%20android.os.StrictMode.OnThreadViolationListener)` is enabled, the listener is called on the
provided executor when a Thread violation occurs.

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/os/StrictMode.OnThreadViolationListener#onThreadViolation(android.os.strictmode.Violation)(https://developer.android.com/reference/android/os/strictmode/Violation v) ` Called on a thread policy violation. |

## Public methods

### onThreadViolation

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

```
public abstract void onThreadViolation (Violation v)
```

Called on a thread policy violation.

<br />

| Parameters ||
|---|---|
| `v` | `Violation` <br /> |