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

# Builder

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/net/StaticIpConfiguration.Builder "View this page in Java")

```
class Builder
```

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

Helper class to build a new instance of `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration`.

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#Builder()()` <br /> |

| Public methods ||
|---|---|
| [StaticIpConfiguration](https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration) | `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#build()()` Create a `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration` from the parameters in this `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#`. |
| [StaticIpConfiguration.Builder](https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#) | `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#setDnsServers(kotlin.collections.MutableIterable)(dnsServers: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-iterable/index.html<https://developer.android.com/reference/kotlin/java/net/InetAddress.html#!>)` Set the addresses of the DNS servers included in the configuration; empty by default. |
| [StaticIpConfiguration.Builder](https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#) | `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#setDomains(kotlin.String)(newDomains: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?)` Sets the DNS domain search path to be used on the link; null by default. |
| [StaticIpConfiguration.Builder](https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#) | `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#setGateway(java.net.InetAddress)(gateway: https://developer.android.com/reference/kotlin/java/net/InetAddress.html#?)` Set the address of the gateway to be included in the configuration; null by default. |
| [StaticIpConfiguration.Builder](https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#) | `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#setIpAddress(android.net.LinkAddress)(ipAddress: https://developer.android.com/reference/kotlin/android/net/LinkAddress)` Set the IP address to be included in the configuration. |

## Public constructors

### Builder

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

```
Builder()
```

## Public methods

### build

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

```
fun build(): StaticIpConfiguration
```

Create a `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration` from the parameters in this `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration` | The newly created StaticIpConfiguration. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if an invalid configuration is attempted, e.g. if an IP Address was not configured via `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#setIpAddress(android.net.LinkAddress)`. |

### setDnsServers

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

```
fun setDnsServers(dnsServers: MutableIterable<InetAddress!>): StaticIpConfiguration.Builder
```

Set the addresses of the DNS servers included in the configuration; empty by default.

| Parameters ||
|---|---|
| `dnsServers` | [MutableIterable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-iterable/index.html)\<[InetAddress](https://developer.android.com/reference/kotlin/java/net/InetAddress.html#)!\>: This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#` | The `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#` for chaining. This value cannot be `null`. |

### setDomains

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

```
fun setDomains(newDomains: String?): StaticIpConfiguration.Builder
```

Sets the DNS domain search path to be used on the link; null by default.

| Parameters ||
|---|---|
| `newDomains` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: A `https://developer.android.com/reference/kotlin/java/lang/String.html#` containing the comma separated domains to search when resolving host names on this link, in priority order. This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#` | The `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#` for chaining. |

### setGateway

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

```
fun setGateway(gateway: InetAddress?): StaticIpConfiguration.Builder
```

Set the address of the gateway to be included in the configuration; null by default.

| Parameters ||
|---|---|
| `gateway` | [InetAddress](https://developer.android.com/reference/kotlin/java/net/InetAddress.html#)?: This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#` | The `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#` for chaining. |

### setIpAddress

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

```
fun setIpAddress(ipAddress: LinkAddress): StaticIpConfiguration.Builder
```

Set the IP address to be included in the configuration.

| Parameters ||
|---|---|
| `ipAddress` | [LinkAddress](https://developer.android.com/reference/kotlin/android/net/LinkAddress): This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#` | The `https://developer.android.com/reference/kotlin/android/net/StaticIpConfiguration.Builder#` for chaining. This value cannot be `null`. |