# WindowManager.BadTokenException

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

# BadTokenException

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/view/WindowManager.BadTokenException "View this page in Java")  

```
open class BadTokenException : RuntimeException
```

|---|---|---|---|----------------------------------------------------------------------------------------------------------------------------------------------|
| [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)                                                         ||||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/kotlin/java/lang/Exception.html#)                                                    |||
|   |   | ↳ | [java.lang.RuntimeException](https://developer.android.com/reference/kotlin/java/lang/RuntimeException.html#)                                   ||
|   |   |   | ↳ | [android.view.WindowManager.BadTokenException](https://developer.android.com/reference/kotlin/android/view/WindowManager.BadTokenException#) |

Exception that is thrown when trying to add view whose [LayoutParams](https://developer.android.com/reference/kotlin/android/view/WindowManager.LayoutParams) [LayoutParams.token](https://developer.android.com/reference/kotlin/android/view/WindowManager.LayoutParams#token:android.os.IBinder) is invalid.

## Summary

|                                                                                                                    Public constructors                                                                                                                     ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [BadTokenException](https://developer.android.com/reference/kotlin/android/view/WindowManager.BadTokenException#BadTokenException())`()` <br />                                                                                                         |
| [BadTokenException](https://developer.android.com/reference/kotlin/android/view/WindowManager.BadTokenException#BadTokenException(kotlin.String))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` <br /> |

## Public constructors

### BadTokenException

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

```
BadTokenException()
```  

### BadTokenException

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

```
BadTokenException(name: String!)
```