# Violation

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/Violation.kt+class:androidx.fragment.app.strictmode.Violation) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.4.0)

*** ** * ** ***

<br />

```
abstract class Violation : RuntimeException
```

<br />

|---|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||||
| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) ||||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception.html) |||
|   |   | ↳ | [java.lang.RuntimeException](https://developer.android.com/reference/java/lang/RuntimeException.html) ||
|   |   |   | ↳ | [androidx.fragment.app.strictmode.Violation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/Violation) |

Known direct subclasses [FragmentReuseViolation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentReuseViolation), [FragmentTagUsageViolation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentTagUsageViolation), [RetainInstanceUsageViolation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/RetainInstanceUsageViolation), [SetUserVisibleHintViolation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/SetUserVisibleHintViolation), [TargetFragmentUsageViolation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/TargetFragmentUsageViolation), [WrongFragmentContainerViolation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/WrongFragmentContainerViolation), [WrongNestedHierarchyViolation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/WrongNestedHierarchyViolation)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentReuseViolation` | See `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#detectFragmentReuse()`. |
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentTagUsageViolation` | See `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#detectFragmentTagUsage()`. |
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/RetainInstanceUsageViolation` | See `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#detectRetainInstanceUsage()`. |
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/SetUserVisibleHintViolation` | See `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#detectSetUserVisibleHint()`. |
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/TargetFragmentUsageViolation` | See `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#detectTargetFragmentUsage()`. |
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/WrongFragmentContainerViolation` | See `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#detectWrongFragmentContainer()`. |
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/WrongNestedHierarchyViolation` | See `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#detectWrongNestedHierarchy()`. |

Known indirect subclasses [GetRetainInstanceUsageViolation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/GetRetainInstanceUsageViolation), [GetTargetFragmentRequestCodeUsageViolation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/GetTargetFragmentRequestCodeUsageViolation), [GetTargetFragmentUsageViolation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/GetTargetFragmentUsageViolation), [SetRetainInstanceUsageViolation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/SetRetainInstanceUsageViolation), [SetTargetFragmentUsageViolation](https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/SetTargetFragmentUsageViolation)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/GetRetainInstanceUsageViolation` | See #`https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#detectRetainInstanceUsage()`. |
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/GetTargetFragmentRequestCodeUsageViolation` | See `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#detectTargetFragmentUsage()`. |
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/GetTargetFragmentUsageViolation` | See `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#detectTargetFragmentUsage()`. |
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/SetRetainInstanceUsageViolation` | See `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#detectRetainInstanceUsage()`. |
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/SetTargetFragmentUsageViolation` | See `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/FragmentStrictMode.Policy.Builder#detectTargetFragmentUsage()`. |

*** ** * ** ***

Root class for all FragmentStrictMode violations.

## Summary

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment` | `https://developer.android.com/reference/kotlin/androidx/fragment/app/strictmode/Violation#fragment()` Gets the `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment` causing the Violation. |

### Inherited functions

From [kotlin.Throwable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/add-suppressed.html(exception: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/fill-in-stack-trace.html()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/init-cause.html(cause: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/print-stack-trace.html()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/print-stack-trace.html(s: https://developer.android.com/reference/java/io/PrintStream.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/print-stack-trace.html(s: https://developer.android.com/reference/java/io/PrintWriter.html)`

### Inherited properties

From [kotlin.Throwable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html?` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/cause.html` `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/localized-message.html` `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/message.html` `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/java/lang/StackTraceElement.html>` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/stack-trace.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html>` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/suppressed.html`

## Public properties

### fragment

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

```
val fragment: Fragment
```

Gets the `https://developer.android.com/reference/kotlin/androidx/fragment/app/Fragment` causing the Violation.