# StrictMode.ThreadPolicy

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

# ThreadPolicy

*** ** * ** ***

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

```
class ThreadPolicy
```

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

[StrictMode](https://developer.android.com/reference/kotlin/android/os/StrictMode)policy applied to a certain thread.

The policy is enabled by[setThreadPolicy](https://developer.android.com/reference/kotlin/android/os/StrictMode#setThreadPolicy(android.os.StrictMode.ThreadPolicy)). The current policy can be retrieved with[getThreadPolicy](https://developer.android.com/reference/kotlin/android/os/StrictMode#getThreadPolicy()).

Note that multiple penalties may be provided and they're run in order from least to most severe (logging before process death, for example). There's currently no mechanism to choose different penalties for different detected actions.

## Summary

|                                                                                                       Nested classes                                                                                                        ||
|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|   | [Builder](https://developer.android.com/reference/kotlin/android/os/StrictMode.ThreadPolicy.Builder) Creates[ThreadPolicy](https://developer.android.com/reference/kotlin/android/os/StrictMode.ThreadPolicy#)instances. |

|                                                                                            Public methods                                                                                             ||
|----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [toString](https://developer.android.com/reference/kotlin/android/os/StrictMode.ThreadPolicy#toString())`()` <br /> |

|                                                                                                                                             Properties                                                                                                                                             ||
|----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[StrictMode.ThreadPolicy](https://developer.android.com/reference/kotlin/android/os/StrictMode.ThreadPolicy#)! | [LAX](https://developer.android.com/reference/kotlin/android/os/StrictMode.ThreadPolicy#LAX:android.os.StrictMode.ThreadPolicy) The lax policy which doesn't catch anything. |

## Public methods

### toString

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

```
fun toString(): String
```

|                                                          Return                                                          ||
|----------------------------------------------------------------------------------|----------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of the object. |

## Properties

### LAX

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

```
static val LAX: StrictMode.ThreadPolicy!
```

The lax policy which doesn't catch anything.