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

# NetworkViolation

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/os/strictmode/NetworkViolation "View this page in Java")

```
class NetworkViolation : Violation
```

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||||
| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html) |||
|   | ↳ | [android.os.strictmode.Violation](https://developer.android.com/reference/kotlin/android/os/strictmode/Violation) ||
|   |   | ↳ | [android.os.strictmode.NetworkViolation](https://developer.android.com/reference/kotlin/android/os/strictmode/NetworkViolation#) |

## Summary

| Inherited functions ||
|---|---|
| From class `https://developer.android.com/reference/kotlin/android/os/strictmode/Violation` |---|---| | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html` | `https://developer.android.com/reference/kotlin/android/os/strictmode/Violation#fillInStackTrace()()` Fills in the execution stack trace. This method records within this `Throwable` object information about the current state of the stack frames for the current thread. If the stack trace of this `Throwable` [is not](https://developer.android.com/reference/kotlin/java/lang/Throwable.html#Throwable(kotlin.String,%20kotlin.Throwable,%20kotlin.Boolean,%20kotlin.Boolean)), calling this method has no effect. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/android/os/strictmode/Violation#hashCode()()` Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by `https://developer.android.com/reference/kotlin/java/util/HashMap.html#`. The general contract of `hashCode` is: - Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. - If two objects are equal according to the `https://developer.android.com/reference/kotlin/java/lang/Object.html#equals(kotlin.Any)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result. - It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/kotlin/java/lang/Object.html#equals(kotlin.Any)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html` | `https://developer.android.com/reference/kotlin/android/os/strictmode/Violation#initCause(kotlin.Throwable)(cause: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html?)` Initializes the *cause* of this throwable to the specified value. (The cause is the throwable that caused this throwable to get thrown.) This method can be called at most once. It is generally called from within the constructor, or immediately after creating the throwable. If this throwable was created with `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#Throwable(kotlin.Throwable)` or `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#Throwable(kotlin.String,%20kotlin.Throwable)`, this method cannot be called even once. An example of using this method on a legacy throwable type without other support for setting the cause is: ```kotlin try { lowLevelOp(); } catch (LowLevelException le) { throw (HighLevelException) new HighLevelException().initCause(le); // Legacy constructor } ``` <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/android/os/strictmode/Violation#setStackTrace(kotlin.Array)(stackTrace: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/java/lang/StackTraceElement.html#!>)` Sets the stack trace elements that will be returned by `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#getStackTrace()` and printed by `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#printStackTrace()` and related methods. This method, which is designed for use by RPC frameworks and other advanced systems, allows the client to override the default stack trace that is either generated by `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#fillInStackTrace()` when a throwable is constructed or deserialized when a throwable is read from a serialization stream. If the stack trace of this `Throwable` [is not](https://developer.android.com/reference/kotlin/java/lang/Throwable.html#Throwable(kotlin.String,%20kotlin.Throwable,%20kotlin.Boolean,%20kotlin.Boolean)), calling this method has no effect other than validating its argument. <br /> | ||